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

[gatsby-transformer-react-docgen] - Cannot read property 'internal' of null #4003

Closed
derekr opened this issue Feb 13, 2018 · 6 comments
Closed

Comments

@derekr
Copy link

derekr commented Feb 13, 2018

Description

When using gatsby-transformer-react-docgen I get an error UNHANDLED REJECTION error during the source and transform stage.

Environment

Gatsby version: ^1.9.158
Node.js version: v9.5.0
Operating System: OSX 10.13.3

File contents (if changed):

gatsby-config.js:

module.exports = {
  siteMetadata: {
    title: 'Gatsby Default Starter',
  },
  plugins: [
    'gatsby-plugin-react-helmet',
    'gatsby-transformer-react-docgen',
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `components`,
        path: `${__dirname}/src/components/`,
      },
    },
  ],
};

package.json:

{
  "name": "gatsby-starter-default",
  "description": "Gatsby default starter",
  "version": "1.0.0",
  "author": "Kyle Mathews <mathews.kyle@gmail.com>",
  "dependencies": {
    "gatsby": "^1.9.158",
    "gatsby-link": "^1.6.34",
    "gatsby-plugin-react-helmet": "^2.0.3",
    "gatsby-source-filesystem": "^1.5.19",
    "gatsby-transformer-react-docgen": "^1.0.13",
    "react-helmet": "^5.2.0"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "main": "n/a",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"src/**/*.js\"",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "prettier": "^1.10.2"
  }
}

gatsby-node.js: not changed
gatsby-browser.js: not changed
gatsby-ssr.js: not changed

Actual result

docgen ☭ npx gatsby develop                                                                    
success delete html files from previous builds — 0.007 s
success open and validate gatsby-config.js — 0.004 s
success copy gatsby files — 0.018 s
success onPreBootstrap — 0.004 s
success source and transform nodes — 0.086 s
error UNHANDLED REJECTION


  TypeError: Cannot read property 'internal' of null
  
  - infer-graphql-input-fields.js:222 
    [docgen]/[gatsby]/dist/schema/infer-graphql-input-fields.js:222:38
  
  - lodash.js:4917 
    [docgen]/[lodash]/lodash.js:4917:15
  
  - lodash.js:3002 baseForOwn
    [docgen]/[lodash]/lodash.js:3002:24
  
  - lodash.js:4886 
    [docgen]/[lodash]/lodash.js:4886:18
  
  - lodash.js:9334 Function.forEach
    [docgen]/[lodash]/lodash.js:9334:14
  
  - infer-graphql-input-fields.js:209 inferInputObjectStructureFromNodes
    [docgen]/[gatsby]/dist/schema/infer-graphql-input-fields.js:209:5
  
  - build-node-types.js:88 _callee$
    [docgen]/[gatsby]/dist/schema/build-node-types.js:88:36
  
  - next_tick.js:150 process._tickCallback
    internal/process/next_tick.js:150:11

Expected behavior

Development server starts and I can query as expected for the react docgen transformer.

Steps to reproduce

gatsby new docgen
cd docgen
yarn add gatsby-source-filesystem gatsby-transformer-react-docgen
npm gatsby develop
@fk fk added the API/Plugins label Feb 13, 2018
@m-allanson
Copy link
Contributor

I was able to recreate this issue from @derekr's report above. I thought maybe the plugin was failing due to there being no docgen blocks, but adding a docblock to the src/components/Header component doesn't make any difference to the console output.

Ah! I was about to pass on this, but it looks like the build will work as long as one of your components has some PropTypes defined. I can see this would be a pretty frustrating problem..

@KyleAMathews or @jquense is it possible to add some logging around this?

@derekr
Copy link
Author

derekr commented Feb 13, 2018

Thanks for following up @m-allanson! Confirmed the propTypes work around. Some logging would be rad. I could take a look at it some time next week if no one hops on it.

@KyleAMathews
Copy link
Contributor

Huh weird. Yeah, we should either log and/or just work around the lack of data from not having propTypes

@pieh
Copy link
Contributor

pieh commented Feb 13, 2018

As this is graphql schema related I will have a look. Is there fast way to reproduce it?

@trickydisco78
Copy link

trickydisco78 commented Feb 23, 2018

I'm getting the exact same error using the datocms-source plugin

datocms/gatsby-source-datocms#11

Have cloned their portfolio repo and getting the same error

added proptypes to the header component but doesn't work :(

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

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

No branches or pull requests

6 participants