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.

Updating entry fails with 'X-Contentful-Version' error

See original GitHub issue

I’m trying to update an entry like so:

client
  .getSpace()
  .then(space => space.getEntry('entryId`))
  .then((entry) => {
    entry.fields.someField = 'some new value'
    return entry.update()
  })

I get the following error message:

Error: “value” required in setHeader(“X-Contentful-Version”, value)

According to the docs, this should be managed by the API:

When updating an existing resource, you need to specify its current version with the X-Contentful-Version HTTP header (this header is automatically set when using our official SDKs).

I’m also seeing these warnings (could this be the cause?):

Deprecated: Space.getEntry() will be removed in future major versions.

Please migrate your code to use Environment.getEntry()

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Apr 24, 2019

Nevermind, it actually worked, I was moving the entry around functions and it might have misplaced its reference.

So, @umair00, you can just do as I did there.

0reactions
kruulikcommented, Oct 17, 2022

I’m experiencing the same issue as described by @umair00

entry.fields.carousel = {
              'en-CA': {
                sys: {
                  type: 'Link',
                  linkType: 'Entry',
                  id: collectionId,
                },
              },
            };
            await entry.update();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors | Contentful
HTTP status code Error code Description 401 Unauthorized AccessTokenInvalid The authorization token was invalid. 422 Unprocessable Entity UnknownField The triggered query references an unknown... 422 Unprocessable...
Read more >
Updating a Contentful entry - Stack Overflow
This error occurs when you're trying to update an existing asset, entry or content type, and you didn't specify the current version of...
Read more >
Unable to publish data into Contentful - APIs
Hi, I believe you are sending the entry id and “X-Contentful-Version”. When updating an entry, need to follow three steps: Get the data...
Read more >
Updating entry fails with 'X-Contentful-Version' error
I'm trying to update an entry like so: client .getSpace() .then(space => space.getEntry('entryId`)) .then((entry) => { entry.fields.
Read more >
Home - Contentful Developer Documentation
JavaScript SDK for Contentful's Content Management API. ... If it is a bug related to the code create a GitHub issue and make...
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