Migrating to GatsbyJS v3, strange error from gatsby-source-wordpress "Found a duplicate ID in WordPress"

Viewed 1045

I just updated my Gatsby to v3. Right before that I had just updated gatsby-source-wordpress to v5 and everything was working with Gatsby v2.32.9

Now when doing gatsby develop, I get the following message :

info  gatsby-source-wordpress

    This is either your first build or the cache was cleared.
    Please wait while your WordPress data is synced to your Gatsby cache.

    Maybe now's a good time to get up and stretch? :D

success  gatsby-source-wordpress  ingest WPGraphQL schema - 2.619s
success createSchemaCustomization - 4.169s

 ERROR

(node:23740) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

success  gatsby-source-wordpress  fetch root fields - 0.730s
success  gatsby-source-wordpress  Comment - 0.853s - fetched 0
success  gatsby-source-wordpress  MenuItem - 1.389s - fetched 1
success  gatsby-source-wordpress  ContentType - 2.484s - fetched 3
success  gatsby-source-wordpress  Category - 4.662s - fetched 25
success  gatsby-source-wordpress  PostFormat - 0.770s - fetched 1
success  gatsby-source-wordpress  Menu - 0.792s - fetched 1
success  gatsby-source-wordpress  Page - 0.996s - fetched 4
success  gatsby-source-wordpress  Tag - 5.938s - fetched 88
success  gatsby-source-wordpress  Post - 19.975s - fetched 367
success  gatsby-source-wordpress  UserRole - 0.943s - fetched 0
success  gatsby-source-wordpress  Taxonomy - 1.459s - fetched 3
success  gatsby-source-wordpress  User - 3.036s - fetched 11
warn  gatsby-source-wordpress  Found a duplicate ID in WordPress - this means you will have fewer nodes in Gatsby than in WordPress. This will need to
 be resolved in WP by identifying and fixing the underlying bug with your WP plugins or custom code.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 2 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 3 times already.
info pushing Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 to the end of the request queue.
info Previously retried 4 times already.
info

already re-queued Media Item query #0, digest: de78a8ecdd99c9e43936d44ad88871f0 5 times :( sorry.
Try lowering process.env.GATSBY_CONCURRENT_DOWNLOAD.
It's currently set to 1



 ERROR

There was an error

not finished source and transform nodes - 51.476s
not finished  gatsby-source-wordpress  fetching nodes - 48.144s - 517 total
not finished  gatsby-source-wordpress  creating nodes - 20.447s
not finished  gatsby-source-wordpress  MediaItem - 20.450s - fetched 13
not finished Downloading remote files - 18.767s

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

My dependencies are as follows :

"dependencies": {
    "cross-env": "^7.0.2",
    "gatsby": "^3.1.1",
    "gatsby-image": "^2.10.0",
    "gatsby-plugin-alias-imports": "^1.0.5",
    "gatsby-plugin-catch-links": "^3.1.0",
    "gatsby-plugin-feed": "^3.1.0",
    "gatsby-plugin-gatsby-cloud": "^2.1.0",
    "gatsby-plugin-google-tagmanager": "^3.1.0",
    "gatsby-plugin-manifest": "^3.1.0",
    "gatsby-plugin-meta-redirect": "^1.1.1",
    "gatsby-plugin-offline": "^4.1.0",
    "gatsby-plugin-react-helmet": "^4.1.0",
    "gatsby-plugin-remove-serviceworker": "^1.0.0",
    "gatsby-plugin-sharp": "^2.13.1",
    "gatsby-plugin-sitemap": "^3.1.0",
    "gatsby-plugin-split-css": "^2.0.0",
    "gatsby-remark-images": "^4.1.0",
    "gatsby-source-filesystem": "^3.1.0",
    "gatsby-source-wordpress": "^5.1.0",
    "gatsby-source-youtube-v3": "^3.0.0",
    "gatsby-transformer-remark": "^3.1.0",
    "gatsby-transformer-sharp": "^3.1.0",
    "graphql": "^15.4.0",
    "i18n-react": "^0.7.0",
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-cookies": "^0.1.1",
    "react-countup": "^4.2.3",
    "react-dom": "^17.0.1",
    "react-helmet": "^6.1.0",
    "react-hubspot-form": "^1.3.7",
    "react-lazyload": "2.6.9",
    "react-responsive-carousel": "^3.1.51",
    "react-scroll": "^1.7.14",
    "react-share": "^4.2.0",
    "react-sticky": "^6.0.3",
    "react-swipeable": "^5.5.1",
    "react-text-loop": "^2.3.0",
    "react-typeform-embed": "^0.2.1"
},
"devDependencies": {
    "gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.10",
    "prettier": "^2.1.2",
    "react-devtools": "^4.10.1"
},

I talked to a rep from WPEngine and they assured me that they could find no duplicate ID in the posts or the users tables.

Has anyone experienced this ? Right now I'm thinking maybe I should upgrade the gatsby-image plugin but I fear it'll break even further and I'll have a hard time differentiating between bugs that are due to gatsby-image and bugs that are due to source-wordpress.

1 Answers

Didn't find a permanent solution, but found a fix...

The problem stemmed from a conflict between my gatsby-source-wordpress and the way my Polylang WP plugin gets exposed to the GraphQL API. Basically, the "Duplicate ID" is related to the first post the API could find that has a translation, and for some reason it breaks. As of this writing this seems to be specific to gatsby-source-wordpress version ^5.0.0 and ^5.1.0. My fix : revert to gatsby-source-wordpress version ^4.1.0-next.1, which does not suffer from the same issue.

This fix works for me with Gatsby v3.1.1.

Related