gatsby: gatsby-source-wordpress fails to build site
I am trying to build my first gatsby powered site, using my current WordPress site (1000 posts and almost 3000 pictures) as a source for gatsby and I cannot get it to build. So far I have just the basic site generated by gatsby new
and the gatsby-source-wordpress
plugin. My gatsby site is published here https://github.com/scruffydan/MindofDan
Description
gatsby develop
doesn’t complete
This is what I get:
=END PLUGIN=====================================: 33804.250ms
error Plugin gatsby-source-wordpress returned an error
TypeError: Cannot read property 'id' of undefined
- normalize.js:275
[MindofDan]/[gatsby-source-wordpress]/normalize.js:275:9
- Array.map
- normalize.js:270 Object.exports.mapElementsToParent
[MindofDan]/[gatsby-source-wordpress]/normalize.js:270:19
- gatsby-node.js:142 _callee$
[MindofDan]/[gatsby-source-wordpress]/gatsby-node.js:142:34
- next_tick.js:61 process._tickCallback
internal/process/next_tick.js:61:11
⠠ source and transform nodes
I am using verboseOutput: true
and concurrentRequests: 10
.
It just hangs at source and transform nodes and never completes. I have left it running for 12 hours.
However I don’t always get the TypeError: Cannot read property 'id' of undefined
error, sometimes it just hangs at source and transform nodes.
Steps to reproduce
Clone the repo https://github.com/scruffydan/MindofDan
run npm install
run gatsby develop
Expected result
The site should build
Actual result
gatsby hangs and doesn’tcomplete
Environment
- Gatsby version (
npm list gatsby
): gatsby@1.9.259 - gatsby-cli version (
gatsby --version
): 1.1.52 - Node.js version: 10.1.0
- Operating System: macOS 10.13.4
File contents (if changed)
gatsby-config.js
:
module.exports = {
siteMetadata: {
title: 'Gatsby Default Starter',
},
plugins: [
'gatsby-plugin-react-helmet',
{
resolve: 'gatsby-source-wordpress',
options: {
baseUrl: 'mind.ofdan.ca',
protocol: 'https',
concurrentRequests: 10,
hostingWPCOM: false,
useACF: false,
verboseOutput: true
}
}
]
}
package.json
:
{
"name": "mind.of.dan",
"description": "Mind of Dan built with Gatsby",
"version": "0.1.0",
"author": "Dan Moutal",
"dependencies": {
"gatsby": "^1.9.259",
"gatsby-link": "^1.6.44",
"gatsby-plugin-react-helmet": "^2.0.11",
"gatsby-source-wordpress": "^2.0.84",
"react-helmet": "^5.2.0"
},
"keywords": [
"gatsby",
"WordPress"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write 'src/**/*.js'",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"prettier": "^1.12.1"
}
}
gatsby-node.js
: N/A
gatsby-browser.js
: N/A
gatsby-ssr.js
: N/A
Thanks in advance
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 21 (5 by maintainers)
@pmarxbraun sorry for the wait. And i think i have a solution for your case.
What i did was:
gatsby-config.js
to match yours and as soon as i issue gatsby develop i’m presented with the following:With that it led me to believe that you followed probably this and this. Which is correct, but not accurate entirely. With this you’ll get into some errors like you did. So with that in mind, going back to the plugin’s documentation page i adjusted the options.
gatsby-config.js
once more to allow the specific routes to be fetched, transforming it into:Issued
gatsby clean
andgatsby develop
, to get a “clean slate” build and the error still. As you can see bellow:Commented out the tags endpoint, yelded the following:
As you can see, the error was fixed.
I was able to fix this issue by adjusting the amount of concurrent items were in the queue in the gatsby-source-filesystem plugin: https://github.com/gatsbyjs/gatsby/blob/15cdf2c77e4e5cd1086b87bc9c828128c9022f24/packages/gatsby-source-filesystem/src/create-remote-file-node.js#L90
It would be nice to have an option in the gatsby-source-filesystem to adjust the amount of concurrent requests that are in the queue. That way on a lesser powerful machine, so the node process doesn’t lock up.
Changing it between 1-50 concurrent requests fixed this for me.