Gatsby: 1.9.210 causes 'TypeError: Cannot read property 'internal' of undefined'

Created on 24 Feb 2018  ยท  6Comments  ยท  Source: gatsbyjs/gatsby

Description

In 1.9.210 and above, running yarn build or yarn dev fails with an unhandled promise exception. In the stacktrace gatsby-remark-copy-linked-files is mentioned, but removing that from the build throws a similar error linked below this one in core gatsby.

Solution: pin gatsby to 19.209 and everything seems to work as expected.

$ gatsby build
success delete html and css files from previous builds โ€” 0.052 s
success open and validate gatsby-config.js โ€” 0.007 s
success copy gatsby files โ€” 0.028 s
success onPreBootstrap โ€” 0.491 s
success source and transform nodes โ€” 1.009 s
success building schema โ€” 0.662 s
success createLayouts โ€” 0.011 s
error Cannot read property 'internal' of undefined

  TypeError: Cannot read property 'internal' of undefined
  - index.js:161
    [blog-gatsby]/[gatsby-remark-copy-linked-files]/index.js:161:60
  - index.js:31 one
    [blog-gatsby]/[unist-util-visit]/index.js:31:16
  - index.js:54 all
    [blog-gatsby]/[unist-util-visit]/index.js:54:25
  - index.js:39 one
    [blog-gatsby]/[unist-util-visit]/index.js:39:14
  - index.js:54 all
    [blog-gatsby]/[unist-util-visit]/index.js:54:25
  - index.js:39 one
    [blog-gatsby]/[unist-util-visit]/index.js:39:14
  - index.js:22 visit
    [blog-gatsby]/[unist-util-visit]/index.js:22:3
  - index.js:154 module.exports
    [blog-gatsby]/[gatsby-remark-copy-linked-files]/index.js:154:3
  - extend-node-type.js:168
    [blog-gatsby]/[gatsby-transformer-remark]/extend-node-type.js:168:32
  - util.js:16 tryCatcher
    [blog-gatsby]/[bluebird]/js/release/util.js:16:23
  - reduce.js:155 Object.gotValue
    [blog-gatsby]/[bluebird]/js/release/reduce.js:155:18
  - reduce.js:144 Object.gotAccum
    [blog-gatsby]/[bluebird]/js/release/reduce.js:144:25
  - util.js:16 Object.tryCatcher
    [blog-gatsby]/[bluebird]/js/release/util.js:16:23
  - promise.js:512 Promise._settlePromiseFromHandler
    [blog-gatsby]/[bluebird]/js/release/promise.js:512:31
  - promise.js:569 Promise._settlePromise
    [blog-gatsby]/[bluebird]/js/release/promise.js:569:18
  - promise.js:606 Promise._settlePromiseCtx
    [blog-gatsby]/[bluebird]/js/release/promise.js:606:10

And:

error Cannot read property 'internal' of null


  TypeError: Cannot read property 'internal' of null

  - infer-graphql-input-fields.js:222
    [blog-gatsby]/[gatsby]/dist/schema/infer-graphql-input-fields.js:222:37

  - lodash.js:4917
    [blog-gatsby]/[lodash]/lodash.js:4917:15

  - lodash.js:3002 baseForOwn
    [blog-gatsby]/[lodash]/lodash.js:3002:24

  - lodash.js:4886
    [blog-gatsby]/[lodash]/lodash.js:4886:18

  - lodash.js:9334 Function.forEach
    [blog-gatsby]/[lodash]/lodash.js:9334:14

  - infer-graphql-input-fields.js:209 inferInputObjectStructureFromNodes
    [blog-gatsby]/[gatsby]/dist/schema/infer-graphql-input-fields.js:209:5

  - build-node-types.js:88 _callee$
    [blog-gatsby]/[gatsby]/dist/schema/build-node-types.js:88:36

  - next_tick.js:73 _combinedTickCallback
    internal/process/next_tick.js:73:7

  - next_tick.js:104 process._tickCallback
    internal/process/next_tick.js:104:9

Environment

Gatsby version: 1.9.210
Node.js version: 8.9.3
Operating System: MacOS

Steps to reproduce

1. Clone https://github.com/orf/blog-gatsby/tree/210 (branch 210)

2. Run yarn && yarn build

3. See that it errors

...

Most helpful comment

Hey guys! I installed the [email protected], dit a gatsby clean && gatsby build but... nothing changed :(

Here my logfile from Netlify

10:19:01 AM: See our docs page for more info on this error: https://gatsby.dev/issue-how-to
10:19:01 AM:
10:19:01 AM: TypeError: Cannot read property 'internal' of undefined
10:19:01 AM:
10:19:01 AM: - schema.js:906 _.flatMap.groupBy.node
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:906:99
10:19:01 AM:
10:19:01 AM: - lodash.js:497 arrayAggregator
10:19:01 AM: [repo]/[lodash]/lodash.js:497:34
10:19:01 AM:
10:19:01 AM: - lodash.js:4823 Function.groupBy
10:19:01 AM: [repo]/[lodash]/lodash.js:4823:16
10:19:01 AM:
10:19:01 AM: - lodash.js:4368
10:19:01 AM: [repo]/[lodash]/lodash.js:4368:28
10:19:01 AM:
10:19:01 AM: - lodash.js:683 arrayReduce
10:19:01 AM: [repo]/[lodash]/lodash.js:683:21
10:19:01 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:19:01 AM:
10:19:01 AM: - lodash.js:4367 baseWrapperValue
10:19:01 AM: [repo]/[lodash]/lodash.js:4367:14
10:19:01 AM:
10:19:01 AM: - lodash.js:9050 LodashWrapper.wrapperValue
10:19:01 AM: [repo]/[lodash]/lodash.js:9050:14
10:19:01 AM:
10:19:01 AM: - schema.js:906 groupChildNodesByType
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:906:142
10:19:01 AM:
10:19:01 AM: - schema.js:829 addImplicitConvenienceChildrenFields
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:829:28
10:19:01 AM:
10:19:01 AM: - schema.js:202 processTypeComposer
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:202:13
10:19:01 AM:
10:19:01 AM:
10:19:01 AM: Skipping functions preparation step: no functions directory set
10:19:01 AM: Caching artifacts

All 6 comments

I can confirm I am getting the of null variety of the error starting with 1.9.210

Sorry folks โ€” missed this earlier. Had a test and everything but the test didn't catch it. Improved the test & fixed the bug. Will release once tests run.

@orf spot on :-) sorry if I spoiled your fun โ€” look like you were pretty close to fixing this :-)

I was going to give it a shot, but I doubt I would have found that! I was studying the diff for a while and didn't spot the issue :(

Thanks for fixing it so quick though ๐Ÿ‘

Hey guys! I installed the [email protected], dit a gatsby clean && gatsby build but... nothing changed :(

Here my logfile from Netlify

10:19:01 AM: See our docs page for more info on this error: https://gatsby.dev/issue-how-to
10:19:01 AM:
10:19:01 AM: TypeError: Cannot read property 'internal' of undefined
10:19:01 AM:
10:19:01 AM: - schema.js:906 _.flatMap.groupBy.node
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:906:99
10:19:01 AM:
10:19:01 AM: - lodash.js:497 arrayAggregator
10:19:01 AM: [repo]/[lodash]/lodash.js:497:34
10:19:01 AM:
10:19:01 AM: - lodash.js:4823 Function.groupBy
10:19:01 AM: [repo]/[lodash]/lodash.js:4823:16
10:19:01 AM:
10:19:01 AM: - lodash.js:4368
10:19:01 AM: [repo]/[lodash]/lodash.js:4368:28
10:19:01 AM:
10:19:01 AM: - lodash.js:683 arrayReduce
10:19:01 AM: [repo]/[lodash]/lodash.js:683:21
10:19:01 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:19:01 AM:
10:19:01 AM: - lodash.js:4367 baseWrapperValue
10:19:01 AM: [repo]/[lodash]/lodash.js:4367:14
10:19:01 AM:
10:19:01 AM: - lodash.js:9050 LodashWrapper.wrapperValue
10:19:01 AM: [repo]/[lodash]/lodash.js:9050:14
10:19:01 AM:
10:19:01 AM: - schema.js:906 groupChildNodesByType
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:906:142
10:19:01 AM:
10:19:01 AM: - schema.js:829 addImplicitConvenienceChildrenFields
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:829:28
10:19:01 AM:
10:19:01 AM: - schema.js:202 processTypeComposer
10:19:01 AM: [repo]/[gatsby]/dist/schema/schema.js:202:13
10:19:01 AM:
10:19:01 AM:
10:19:01 AM: Skipping functions preparation step: no functions directory set
10:19:01 AM: Caching artifacts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  ยท  3Comments

Oppenheimer1 picture Oppenheimer1  ยท  3Comments

mikestopcontinues picture mikestopcontinues  ยท  3Comments

magicly picture magicly  ยท  3Comments

kalinchernev picture kalinchernev  ยท  3Comments