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.

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

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
piehcommented, Feb 26, 2020

This should be fixed in gatsby-source-contentful@2.1.88

4reactions
devpatocommented, Feb 17, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-source-contentful
You may workaround with an extra content entry with all fields filled out. When using reference fields, be aware that this source plugin...
Read more >
gatsby-source-contentful
Gatsby source plugin for building websites using the Contentful CMS as a data source. Latest version: 8.3.1, last published: 11 days ago.
Read more >
Using Gatsby with Nacelle
Gatsby -Source-Nacelle (opens new window) is a Gatsby plugin that sources data from Nacelle's Storefront API. This connection allows you to get all...
Read more >
Using Contentful and Gatsby Together
We're gonna build a Gatsby site, and we're gonna use Contentful to manage the data. So ... So, you can click Add Entry,...
Read more >
How to retrieve asset in Gatsby Source Contentful? (not ...
My goal is to get the GPX file in one of my React component, parse it and display it on a map. But...
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