Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.9.210 causes 'TypeError: Cannot read property 'internal' of undefined' #4216

Closed
orf opened this issue Feb 24, 2018 · 6 comments
Closed

1.9.210 causes 'TypeError: Cannot read property 'internal' of undefined' #4216

orf opened this issue Feb 24, 2018 · 6 comments
Assignees

Comments

@orf
Copy link

@orf orf commented Feb 24, 2018

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

...

@jeffwillette
Copy link
Collaborator

@jeffwillette jeffwillette commented Feb 24, 2018

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

@orf
Copy link
Author

@orf orf commented Feb 24, 2018

Tracked it down to a937768

KyleAMathews added a commit that referenced this issue Feb 24, 2018
@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Feb 24, 2018

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.

@ghost ghost assigned KyleAMathews Feb 24, 2018
@ghost ghost added the review label Feb 24, 2018
@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Feb 24, 2018

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

@orf
Copy link
Author

@orf orf commented Feb 24, 2018

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 👍

@Sarah86
Copy link

@Sarah86 Sarah86 commented Aug 7, 2019

Hey guys! I installed the babel-plugin-remove-graphql-queries@2.7.2, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants