Gatsby: [gatsby-source-contentful] Gatsby build caches are too agressive / unpublished contentful entries

Created on 29 Jul 2019  路  13Comments  路  Source: gatsbyjs/gatsby

Description

Unpublishing an entry in contentful leads to a runtime error in gatsby build.

Steps to reproduce

  1. Run gatsby clean
  2. Create a content entry
  3. Publish the entry
  4. Run gatsby build
  5. Unpublish the content entry
  6. Run gatsby build

Expected result

The page create when published should be removed when building again.

Actual result

$ gatsby build
success open and validate gatsby-configs - 0.089 s
success load plugins - 0.166 s
success onPreInit - 0.017 s
success delete html and css files from previous builds - 0.037 s
success initialize cache - 0.025 s
success copy gatsby files - 0.064 s
success onPreBootstrap - 0.035 s
Starting to fetch data from Contentful
Fetching default locale
default locale is : en-US
contentTypes fetched 9

 ERROR #11321  PLUGIN

"gatsby-source-contentful" threw an error while running the sourceNodes lifecycle:

The plugin "gatsby-source-contentful" deleted a node of a type owned by another plugin.

          The node type "ContentfulArtikel" is owned by "undefined".

          The node object passed to "deleteNode":

          {
    "title": "test",
    "slug": "test",
    "date": "2019-07-01T00:00",
    "isNews": false,
    "useArticleDisplayAutomatism": false,
    "isIndexable": false,
    "hasSitemapEntry": false,
    "category___NODE": "66fa2e59-35c9-5e48-ae15-788357176313",
    "primaryPicture___NODE": [
        "57f8dca3-95fa-57f6-8fab-645ad3c53ba4"
    ],
    "id": "a8cb3ba2-47e6-5045-be60-d102bdbc4c63",
    "contentful_id": "5nup2BFtdfBQKMbD1Mz772",
    "createdAt": "2019-07-29T15:55:29.459Z",
    "updatedAt": "2019-07-29T15:58:21.361Z",
    "parent": "Artikel",
    "children": [
        "57f8dca3-95fa-57f6-8fab-645ad3c53ba4"
    ],
    "internal": {
        "type": "ContentfulArtikel",
        "contentDigest": "2aec8d5cc9d01c24d09a86acc479c8df",
        "owner": "gatsby-source-contentful"
    },
    "node_locale": "en-US"
}

          The plugin deleting the node:

          {
    "resolve": "/xxx/node_modules/gatsby-source-contentful",
    "id": "b8fcd892-632b-5ae5-aecf-6a3156d9aa8f",
    "name": "gatsby-source-contentful",
    "version": "2.1.14",
    "pluginOptions": {
        "plugins": [],
        "spaceId": "xxx",
        "environment": "xxx",
        "accessToken": "xxx",
        "host": "cdn.contentful.com"
    },
    "nodeAPIs": [
        "setFieldsOnGraphQLNodeType",
        "onPreBootstrap",
        "sourceNodes",
        "onPreExtractQueries"
    ],
    "browserAPIs": [],
    "ssrAPIs": [],
    "pluginFilepath": "/xxx/node_modules/gatsby-source-contentful"
}

Environment


  System:
    OS: Linux 5.2 Arch Linux undefined
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
    Shell: 5.0.7 - /bin/bash
  Binaries:
    Node: 10.15.0 - /tmp/yarn--1564416284644-0.9074305935989049/node
    Yarn: 1.17.3 - /tmp/yarn--1564416284644-0.9074305935989049/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
  Languages:
    Python: 3.7.3 - /usr/bin/python
  Browsers:
    Firefox: 68.0.1
bug

Most helpful comment

This should be fixed in [email protected]

All 13 comments

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

This is not stale.

  1. Create a content entry
  2. Publish the entry

Are these your only entries in your type? So does other data exist?

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.

Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

Still happening for me.

happening for me too

Is this issue got fixed? Its happening for me too. Why #Gatsby ignoring such a #critical_bugs?

Screenshot 2020-01-28 at 11 28 40 AM

How to fix it?

@Saran010 I erased the cache folder and it worked for me

Agreed, this is definitely a bug and should be re-opened. gatsby clean is a workaround, but unpublishing an item in the CMS should not break local dev.

Additional information that I don't see supplied above:

  • This prevents all the GraphQL queries around Contentful from appearing in the /___graphql available queries list - effectively breaking all Contentful aspects of the site. (side note: when using TypeScript, as we are, this also breaks non-Contentful pages because of TypeScript errors).
  • This happens even when there are remaining entries for a given content type that had an entry Unpublished, and when there are other content types with entries.

This should be fixed in [email protected]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  路  3Comments

signalwerk picture signalwerk  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

rossPatton picture rossPatton  路  3Comments

jimfilippou picture jimfilippou  路  3Comments