gatsby: [gatsby-source-contentful] Error at fresh installment

Hey. I’m currently trying to setup a basic gatsby site with the contentful-source-plugin. Last week everything went pretty great, until that moment I had to show off my results and - bam - the whole thing went down in 5 minutes. I had no success in recreating and debugging.

Specifically gatsby-source-contentful errors out with the following: entryItemFields[foreignReference.name].push is not a function

Preconditions: node -v: 8.9.1 gatsby-cli -v: 1.1.24 gatsby-cource-contentful version: tried everyone from 1.3.20 to 1.3.28

Steps to reproduce:

  1. npm i -g gatsby-cli
  2. gatsby new testdir && cd testdir
  3. yarn add gatsby-source-contentful -S
  4. Editing gatsby-config.js
plugins: [
    {
      resolve: `gatsby-source-contentful`,
      options: {
        spaceId: `MY_CORRECT_SPACEID`,
        accessToken: `MY_CORRECT_ACCESS_TOKEN`,
      },
    },
    `gatsby-plugin-react-helmet`
  ],
  1. (optionally) Editing gatsby-node.js and inserting/editing code from example gatsby-contentful-site

Thanks for any help!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 5
  • Comments: 28 (7 by maintainers)

Most upvoted comments

Just wondering if there had been any updates on this issue. I’m seeing the same thing as soon as I added references into my contentful data. It seems to be happening on build or develop. I tried using the previous method of deleting the redux-state.json in cache then rerunning but it doesn’t seem to make a difference.

@cpannwitz I fully agree. I was able to circumvent the issue for about a day. I had to redo the Content models and content to get it to work. Luckily, I am at testing so this is no big deal. However, once I had the need to edit the content. The issue appeared again.

Like you I noticed the following:

  • References are dropped altogether. For my edited contents the references were null. Untouched elements remained pristine. Note, gatsby did launch and did not error out on compile time
  • The issue with compile time occurred when I deleted those invalid elements. It is like they are negotiating on the deleted element. I would have to recreate the deleted element for gatsby to compile.

At this point, I would like to know what do we do from here? What is the next step and I’ll take it.

Not sure if this helps but this happens to me when I have the following schema:

BUTTON toPage: PAGE

PAGE components: BUTTON

if Button has a page reference (any page, even ones that don’t have it as a component) it will throw.

Can you check if gatsby-source-contentful@2.1.35 fixed this issue. @frodd might think his fix could be related.

I’m also running into this. Adding a one to many content link does it.

Seems to be related with Contentful itself. Creating a new workspace without any content doesn’t throw.

My Contentful content type structure: https://preview.ibb.co/mTg4kG/Bildschirmfoto_2017_11_29_um_11_39_05.png

None of these fields are empty, no other Locale is enabled than the default (German).

EDIT:

Managed to get it to work, by deleting the field References (many) on my second content type. It referenced entries from the first content type, wasn’t empty or (I assume) otherwise corrupted.

Are there any known issues with this specific content field type?