"migrationCreator is not a function" when using contentful-migration "runMigration"
See original GitHub issueExpected Behavior
-The contentful-migration library should work as described in readme file. -The runMigration command should run the multiple migration scripts.
Actual Behavior
`mbpus0477hsra18:<DIR> <USUR_NAME>$ contentful space migration --space-id <SPACE_ID> scripts/contentful-migrations/migration_runner.js
TypeError: migrationCreator is not a function
at /Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/contentful-migration/built/lib/migration-steps/index.js:139:16
at tryCatcher (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/bluebird/js/release/method.js:39:29)
at Object.migration (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/contentful-migration/built/lib/migration-steps/index.js:138:23)
at migration (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/contentful-migration/built/lib/migration-parser.js:43:49)
at run (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/node_modules/contentful-migration/built/bin/cli.js:53:29)
at exports.migration (/Users/<USUR_NAME>/.nvm/versions/node/v9.11.1/lib/node_modules/contentful-cli/dist/cmds/space_cmds/migration.js:82:28)
at <anonymous>
`
const runMigration = require('contentful-migration/built/bin/cli').default;
const path = require('path');
const options = {
spaceId: '<SPACE_ID>',
accessToken:
'<TOKEN>',
yes: true,
};
const migrations = async () => {
await runMigration({
...options,
...{
filePath: path.join(__dirname, '<FILE_PATH>'),
},
});
await runMigration({
...options,
...{ filePath: path.join(__dirname, '<FILE_PATH>') },
});
await runMigration({
...options,
...{ filePath: path.join(__dirname, '<FILE_PATH>') },
});
await runMigration({
...options,
...{ filePath: path.join(__dirname, '<FILE_PATH>') },
});
};
migrations();
Steps to Reproduce
- Run the script in the console
Context
I am unable to run the migration scripts in order. The error that is provided is not very helpful and seems to be an internal application error.
Environment
- Node Version: 9.11.1
- Package Manager Version: 5.6
- Operating System: MAC OS 10.13.5
- Package Version: “contentful-migration”: “^0.10.0”,
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
TypeError: migrationCreator is not a function - Stack Overflow
With this in mind, am I best to store JSON values for the multiple assets I want to upload in a seperate file,...
Read more >The right way to migrate content the Contentful Migration CLI
With the Contentful Migration CLI, we offer a framework that makes migrations easy and that also makes it possible for developers to script ......
Read more >Issues with the contentful migration CLI - APIs
I am having issues with the contentful migration cli tool. When I run the tool with the angry-dog.js I get the following: TypeError: ......
Read more >Contentful Migration Tooling - YouTube
They spend time writing migration scripts and showcase how you can use the command line tooling to programmatically make content model ch …...
Read more >The contentful-migration from contentful - Coder Social
const { runMigration } = require('contentful-migration') function ... "migrationCreator is not a function" when using contentful-migration "runMigration" ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
runMigration
is not intended to be used with the contentful-cli runner. The CLI actually usesrunMigration
to do the migration. For that it needs to receive a function (what you export from the migration file).Your “migration file” is a simple one-off method call. Nothing is exported, so nothing can be run. Agreed, the error message could be a bit nicer.
Out of curiosity: where did you get the impression from, that you could do such thing with the
contentful-cli
and our migration tooling?Thank you, we will have a look