Gatsby: UNHANDLED REJECTION TypeError during build process

Created on 11 Aug 2017  ·  6Comments  ·  Source: gatsbyjs/gatsby

Hey folks. My code is at this repo Everything goes smooth during development, but 'gatsby build' gets hung up at "run graphQL queries." following these two errors:

⠁ UNHANDLED REJECTION TypeError: Cannot read property 'component' of undefined at /home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:139:47 at Array.map (native) at runQueriesForIds (/home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:134:26) at _callee$ (/home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:52:18) at tryCatch (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:117:21) at step (/home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) at /home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14 at new Promise (/home/ubuntu/workspace/node_modules/core-js/library/modules/es6.promise.js:177:7) at /home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12 at _callee$ (/home/ubuntu/workspace/node_modules/gatsby/dist/bootstrap/index.js:396:20) at tryCatch (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:117:21) at step (/home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)

UNHANDLED REJECTION TypeError: Cannot read property 'component' of undefined at /home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:139:47 at Array.map (native) at runQueriesForIds (/home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:134:26) at _callee$ (/home/ubuntu/workspace/node_modules/gatsby/dist/internal-plugins/query-runner/page-query-runner.js:52:18) at tryCatch (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:117:21) at step (/home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) at /home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14 at new Promise (/home/ubuntu/workspace/node_modules/core-js/library/modules/es6.promise.js:177:7) at /home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12 at _callee$ (/home/ubuntu/workspace/node_modules/gatsby/dist/bootstrap/index.js:396:20) at tryCatch (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:65:40) at Generator.invoke [as _invoke] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:303:22) at Generator.prototype.(anonymous function) [as next] (/home/ubuntu/workspace/node_modules/regenerator-runtime/runtime.js:117:21) at step (/home/ubuntu/workspace/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30) ⠁ run graphql queries

Config:
module.exports = { siteMetadata: { title: "Vince Picone ", }, plugins: ["gatsby-plugin-styled-components", "gatsby-plugin-react-helmet"], }

Most helpful comment

It is a bug that seems to keep persisting. Delete your cache before you run gatsby build.

All 6 comments

It is a bug that seems to keep persisting. Delete your cache before you run gatsby build.

Worked like a charm. Thanks.

I do experience the same bug very often, maybe someone should investigate ?

Yeah deleting .cache isn't a good solution — the .cache has to be 100% reliable so let's figure out what the bug is.

@vpicone excited to have a nice reproducible example! Except there seems to be some files missing from your repo? Tried installing and running it and got this error:

These relative modules were not found:

* ../components/github.svg in ./src/pages/connect.js
* ../components/linkedin.svg in ./src/pages/connect.js
* ../components/twitter.svg in ./src/pages/connect.js
* ./tint-drop.svg in ./src/components/Navbar.js

People in this thread — how often are you seeing errors like this now? Feels like we've made a lot of improvements.

Closing this issue as it's fairly old and we have far too many open issues! If you have additional problems in this area, please open a new issue!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kalinchernev picture kalinchernev  ·  3Comments

Oppenheimer1 picture Oppenheimer1  ·  3Comments

benstr picture benstr  ·  3Comments

KyleAMathews picture KyleAMathews  ·  3Comments

signalwerk picture signalwerk  ·  3Comments