question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run Contentful Compose migrations scripts

See original GitHub issue

Expected Behavior

Using the experimental version of the CLI for migrations should allow me to use the relationshipType validation on a field to work with Compose.

Followed steps on this page

Actual Behavior

Error in regards to relationshipType validation.

Error: A field can't have "relationshipType" as a validation.
Error: A field can't have "relationshipType" as a validation.

Publish Content Type page
🚨  Migration unsuccessful
🚨  Error: Validation Errors
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Error: Validation Errors                                                     β”‚
β”‚     at run                                                                   β”‚
β”‚ (/usr/local/lib/node_modules/contentful-cli/node_modules/contentful-migrati… β”‚
β”‚     at processTicksAndRejections (internal/process/task_queues.js:97:5)      β”‚

Possible Solution

Someone I know has the CLI working when the contentful-migration dependency of the CLI is set to 4.2.0-experimental.4.

After installing the contentful-cli@experimental package locally and looking at the package-lock.json, the contentful-migration dependency is set to "contentful-migration": "^4.2.0-experimental.1". However, the actual version being installed when installing the CLI locally and globally is 4.2.3. This makes sense to me since the version set will allow for newer minor and patch versions to be installed. The experimental patch version would probably need to be fixed in order to consistently get it.

Steps to Reproduce

  1. Have tried with Node versions 12 and 14.
  2. npm cache clean --force
  3. npm install -g contentful-cli@experimental
  4. npm list -ag | grep contentful -> shows contentful-migration@4.2.3 as the CLI dependency
  5. contentful space migration --space-id <space-id> --environment-id <env> --management-token <mgmt-token> --header "x-contentful-enable-alpha-feature: assembly-types" <migration-script-file.js> using an example like this one here
  6. Error above is shown

Context

I am trying to run migration scripts that work with Contentful Compose via the CLI. Specifically, I am creating a new page type and am updating the page content type to link to the my new page type. Looks essentially the same as example here.

I am completely unable to run my migration scripts that work with Compose which is blocking us.

Observations and things I’ve tried:

  • Cleared npm cache
  • Different Node/NPM versions (node 14 and 12)
  • Manual global install of experimental contentful-migration package before global install of contentful-cli@experimental
  • Local installation
  • Installing contentful-cli using the --save-exact npm install flag and the --strict-peer-deps flags

Environment

  • Language Version: v14.17.0
  • Package Manager Version: 7.17.0
  • Browser Version: n/a
  • Operating System: Darwin US3CREM00F9JG5J 19.6.0 Darwin Kernel Version 19.6.0: Thu May 6 00:48:39 PDT 2021; root:xnu-6153.141.33~1/RELEASE_X86_64 x86_64
  • Package Version: contentful-cli@1.6.3-experimental.1

Same error occurring with a node:12.22.1-buster-slim Docker container running npm install -g contentful-cli@experimental

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
marcolinkcommented, Jul 16, 2021

Hi @thomas-ej-mcdonald,

we created a new version where contentful-migration@4.2.0-experimental.1 is pinned!

1reaction
thomas-ej-mcdonaldcommented, Jul 16, 2021

@marcolink you as well!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI tools and Compose - Contentful
Learn how to use Contentful CLI tools in conjunction with Compose. Create an initial migration for the content model. Adding reference fields and...
Read more >
Catching errors or aborted runs when using migration CLI as a ...
I am trying to create a process and automated scripts for running migrations against multiple environments on our CI. Our plan is, when...
Read more >
Contentful Best Practices For Scripted Migrations
The guide describes how to write migration scripts and run them against Contentful to alter its schema. However, it doesn't provide guidance ......
Read more >
Contentful migration strategy – blog - Brian Schiller
When I write migrations, they're committed to the code repo. ... Most scripts are not idempotent: they'll fail if they're run a second...
Read more >
Contentful Migration Tooling - YouTube
Stefan (https://twitter.com/stefanjudis) and Shy take an hour to investigate the Contentful CLI ... Your browser can't play this video.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found