gatsby-transformer-react-docgen fails on hot reloads

Created on 10 Dec 2019  路  9Comments  路  Source: gatsbyjs/gatsby

Description

The development build keeps crashing when changes are saved in components that seem to have an mdx file associated with it, or at least that seems to be when it fails the most. When the build goes to rebuild, it returns the following error (detailed error below)... UNHANDLED REJECTION Type with name "ComponentMethodParams" does not exists and the server crashes.

Steps to reproduce

In this repo, gatsby-test-project, all you have to do is add a .mdx file that matches the name of a component in that component's folder. For instance, create a new file at /src/components/app/header.mdx.

In this repo, my-portfolio, if you make any changes to components that seem to have an mdx file associated with them it crashes, such as making a change to /src/components/layout/Layout.js

Expected result

It seems like there's some sort of race condition going on. I've tried moving the plugin around in the list within the gatsby-config.js file, but it doesn't seem to make a difference.
It should not crash with the following error...

UNHANDLED REJECTION Type with name "ComponentMethodParams" does not exists



  Error: Type with name "ComponentMethodParams" does not exists

  - TypeStorage.js:44 SchemaComposer.get
    [gatsby-test-project]/[graphql-compose]/lib/TypeStorage.js:44:13

  - SchemaComposer.js:530 SchemaComposer.getAnyTC
    [gatsby-test-project]/[graphql-compose]/lib/SchemaComposer.js:530:19

  - sort.js:116 Object.keys.forEach.fieldName
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:116:45

  - Array.forEach

  - sort.js:92 convert
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:92:23

  - sort.js:117 Object.keys.forEach.fieldName
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:117:35

  - Array.forEach

  - sort.js:92 convert
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:92:23

  - sort.js:117 Object.keys.forEach.fieldName
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:117:35

  - Array.forEach

  - sort.js:92 convert
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:92:23

  - sort.js:45 getFieldsEnum
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:45:18

  - sort.js:58 getSortInput
    [gatsby-test-project]/[gatsby]/dist/schema/types/sort.js:58:24

  - schema.js:1104 addTypeToRootQuery
    [gatsby-test-project]/[gatsby]/dist/schema/schema.js:1104:23

  - schema.js:270 processTypeComposer
    [gatsby-test-project]/[gatsby]/dist/schema/schema.js:270:13

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7


not finished rebuild schema - 0.296s

Environment

  System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.13.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.2 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/local/bin/python
  Browsers:
    Chrome: 78.0.3904.108
    Safari: 13.0.3
  npmPackages:
    gatsby: ^2.18.10 => 2.18.10
    gatsby-image: ^2.2.36 => 2.2.36
    gatsby-plugin-manifest: ^2.2.33 => 2.2.33
    gatsby-plugin-mdx: ^1.0.61 => 1.0.61
    gatsby-plugin-offline: ^3.0.29 => 3.0.29
    gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18
    gatsby-plugin-sass: ^2.1.26 => 2.1.26
    gatsby-plugin-sharp: ^2.3.7 => 2.3.7
    gatsby-source-filesystem: ^2.1.42 => 2.1.42
    gatsby-transformer-react-docgen: ^5.0.24 => 5.0.24
    gatsby-transformer-sharp: ^2.3.9 => 2.3.9
  npmGlobalPackages:
    gatsby: 2.18.5

Most helpful comment

So far so good! Thanks again!!! Updated to [email protected] and [email protected], made a typical change that crashes the dev server and no crashes this time.

All 9 comments

I'm not using mdx, and have the same issue. Works with 2.17.17, so I suspect it has something to do with schema rebuilding (#19092) introduced in 2.18.

Glad I'm not the only one with the issue and hope it gets addressed or someone figures out a work around. It's quite annoying having to start the dev server up over and over.

Does it fail during build or develop only?

build works for me. develop works until I edit and save a file.

During development. I can successfully build and even make changes to some files, but anything that seems to be imported in multiple components or has an mdx file I have associated with it for documentation purposes seems to crash the server when I save and it tries to hot reload.

Oh, also I dropped my Gatsby version down to 2.17.17 as @tu4mo mentioned and I'm not having any problems with that version.

Wow, that was pretty fast! Thanks guys. I'll give it a shot once it's published.

Please try the fix in [email protected]

So far so good! Thanks again!!! Updated to [email protected] and [email protected], made a typical change that crashes the dev server and no crashes this time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

ferMartz picture ferMartz  路  3Comments

magicly picture magicly  路  3Comments

ghost picture ghost  路  3Comments