Gatsby: Missing onError handler for invocation 'rebuildSchemaWithSitePage'

Created on 18 Aug 2020  路  8Comments  路  Source: gatsbyjs/gatsby

Description

Missing onError handler for invocation 'rebuildSchemaWithSitePage', error was 'TypeError: Cannot read property 'contents' of null'. Stacktrace was 'TypeError: Cannot read property 'contents' of null
    at get (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:10:20)
    at map (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:20:59)
    at Array.map (<anonymous>)
    at getArray (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:19:6)
    at get (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:12:36)
    at get (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:13:50)
    at get (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:13:50)
    at get (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:13:50)
    at getValueAt (/home/simon/tmp/bug-repro/node_modules/gatsby/src/utils/get-value-at.ts:4:10)
    at getFirstValueAt (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/is-file.ts:14:15)
    at find (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/is-file.ts:84:13)
    at Array.find (<anonymous>)
    at getFilePath (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/is-file.ts:83:41)
    at isFile (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/is-file.ts:91:20)
    at getSimpleFieldConfig (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/add-inferred-fields.js:315:11)
    at getFieldConfig (/home/simon/tmp/bug-repro/node_modules/gatsby/src/schema/infer/add-inferred-fields.js:174:19)'

Steps to reproduce

Minimal reproduction: https://github.com/SimonSiefke/gatsby-bug

  1. Run gatsby develop
  2. Error occurs

Expected result

No Error

Actual result

Error

Environment


  System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 14.3.0 - ~/.nvm/versions/node/v14.3.0/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v14.3.0/bin/yarn
    npm: 6.14.5 - ~/.nvm/versions/node/v14.3.0/bin/npm
  Browsers:
    Chrome: 84.0.4147.125
    Firefox: 79.0
  npmPackages:
    gatsby: ^2.24.47 => 2.24.47 
  npmGlobalPackages:
    gatsby-cli: 2.12.87

confirmed GraphQL state machine bug

Most helpful comment

Does gatsby clean work for you? I think it is working for me.

All 8 comments

I just reproduced this and I think there are 2 separate problems here:

  1. is actual problem of error in rebuildSchemaWithSitePage (that's why I tagged with GraphQL label)
  2. is that we get stuck after this error happened (see the gif) and don't have onError handler to handle it - and handling it might just mean calling reporter.panic (that's why I tagged with State Machine label)

Kapture 2020-08-21 at 16 56 13

We just published [email protected] which fixes the root problem. I locally checked the provided reproduction and it no longer result in this error after upgrading gatsby.

Just encountered the same issue on [email protected] but upgrading to [email protected] fixed it. Just in case someone else comes across this again.

Its happening again on [email protected]

Also happening on @gatsby@^2.24.91

Also happening on [email protected]

Does gatsby clean work for you? I think it is working for me.

Does gatsby clean work for you? I think it is working for me.

Yes, that seems to have worked for me too. I also noticed that if I use npm to update modules I get the issue but not if I use yarn.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hobochild picture hobochild  路  3Comments

benstr picture benstr  路  3Comments

rossPatton picture rossPatton  路  3Comments

ghost picture ghost  路  3Comments

ferMartz picture ferMartz  路  3Comments