gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

Crash when any page includes graphql query #22376

Closed Somiona closed 4 years ago

Somiona commented 4 years ago

Description

When any of pages used graphql query and run gatsby develop will lead to crash at the state of onPostBootstrap But if I start develop server with no query first, and then add a new query into page, everything will work just fine. I'm using yarn. But npm results the same thing.

Steps to reproduce

I'm using typescript.

core code:

import { graphql, useStaticQuery } from "gatsby"

const useSiteMeta = () => {
    const { site } = useStaticQuery(graphql`
        query SiteMeta {
            site {
                siteMetadata {
                    siteName
                }
            }
        }
    `)
    const siteMetadata = site?.siteMetadata
    return siteMetadata
}
export default useSiteMeta
"dependencies": {
        "@fortawesome/fontawesome-svg-core": "^1.2.26",
        "@fortawesome/free-brands-svg-icons": "^5.12.0",
        "@fortawesome/free-regular-svg-icons": "^5.12.1",
        "@fortawesome/free-solid-svg-icons": "^5.12.0",
        "@fortawesome/react-fontawesome": "^0.1.8",
        "bootstrap": "^4.4.1",
        "react": "^16.13.0",
        "react-bootstrap": "^1.0.0-beta.16",
        "react-dom": "^16.12.0",
        "react-helmet": "^5.2.1",
        "remarkable": "^2.0.0",
        "typed.js": "^2.0.11"
    },
    "devDependencies": {
        "@babel/core": "^7.7.7",
        "@types/bootstrap": "^4.3.1",
        "@types/node": "^13.9.1",
        "@types/prismjs": "^1.16.0",
        "@types/react": "^16.9.17",
        "@types/react-dom": "^16.9.5",
        "@types/react-helmet": "^5.0.15",
        "@types/remarkable": "^1.7.4",
        "@typescript-eslint/eslint-plugin": "^2.23.0",
        "@typescript-eslint/eslint-plugin-tslint": "^2.23.0",
        "@typescript-eslint/parser": "^2.23.0",
        "eslint": "^6.8.0",
        "eslint-config-prettier": "^6.10.0",
        "eslint-loader": "^3.0.3",
        "eslint-plugin-prettier": "^3.1.2",
        "eslint-plugin-react": "^7.19.0",
        "eslint-plugin-react-hooks": "^2.5.0",
        "gatsby": "^2.19.7",
        "gatsby-image": "^2.2.43",
        "gatsby-plugin-catch-links": "^2.1.21",
        "gatsby-plugin-eslint": "^2.0.8",
        "gatsby-plugin-generate-typings": "^0.9.8-r1",
        "gatsby-plugin-google-analytics": "^2.1.31",
        "gatsby-plugin-manifest": "^2.2.39",
        "gatsby-plugin-minify-classnames": "^0.1.2",
        "gatsby-plugin-offline": "^3.0.40",
        "gatsby-plugin-purgecss": "^4.0.1",
        "gatsby-plugin-react-helmet": "^3.1.23",
        "gatsby-plugin-robots-txt": "^1.5.0",
        "gatsby-plugin-sass": "^2.1.26",
        "gatsby-plugin-sharp": "^2.4.12",
        "gatsby-plugin-sitemap": "^2.2.29",
        "gatsby-plugin-typescript": "^2.2.3",
        "gatsby-remark-copy-linked-files": "^2.1.39",
        "gatsby-remark-images": "^3.1.49",
        "gatsby-remark-prismjs": "^3.3.35",
        "gatsby-remark-responsive-iframe": "^2.2.33",
        "gatsby-remark-smartypants": "^2.1.19",
        "gatsby-source-filesystem": "^2.1.55",
        "gatsby-transformer-json": "^2.2.22",
        "gatsby-transformer-remark": "^2.6.58",
        "gatsby-transformer-sharp": "^2.3.9",
        "node-sass": "^4.13.1",
        "prettier": "^1.19.1",
        "prismjs": "^1.18.0",
        "tslint": "^6.1.0",
        "typed-scss-modules": "^1.0.1",
        "typescript": "^3.7.4",
        "webpack": "^4.41.5"
    }

and gatsby-config.js is configured as:

module.exports = {
    /* Your site config here */
    siteMetadata: {
        siteName: "白咕咕のエラーはっせい記録",
        author: "Somiona",
    } /* plugins setting not included*/
}

Expected result

It should at least run without crash.

Actual result

ERROR

error when trying to parse schema, ignoring Unable to find any GraphQL type defintions for the following pointers: C:\HomePage.cache\fragments*.js

Error: Unable to find any GraphQL type defintions for the following pointers: C:\HomePage.cache\fragments *.js

UNHANDLED REJECTION Cannot read property 'definitions' of undefined

TypeError: Cannot read property 'definitions' of undefined

Environment

System: OS: Windows 10 10.0.18363 CPU: (12) x64 AMD Ryzen 5 2600X Six-Core Processor
Binaries: Node: 12.16.1 - C:\Users\54357\scoop\apps\nodejs-lts\current\node.EXE Yarn: 1.22.4 - C:\Users\54357\scoop\apps\yarn\current\Yarn\bin\yarn.CMD npm: 6.13.4 - C:\Users\54357\scoop\apps\nodejs-lts\current\npm.CMD Languages: Python: 3.7.7 - C:\Users\54357\scoop\shims\python.EXE Browsers: Edge: 44.18362.449.0 npmPackages: gatsby: ^2.19.7 => 2.19.43 gatsby-image: ^2.2.43 => 2.2.43 gatsby-plugin-catch-links: ^2.1.21 => 2.1.27 gatsby-plugin-eslint: ^2.0.8 => 2.0.8 gatsby-plugin-generate-typings: ^0.9.8-r1 => 0.9.8-r1 gatsby-plugin-google-analytics: ^2.1.31 => 2.1.37 gatsby-plugin-manifest: ^2.2.39 => 2.2.47 gatsby-plugin-minify-classnames: ^0.1.2 => 0.1.2 gatsby-plugin-offline: ^3.0.40 => 3.0.40 gatsby-plugin-purgecss: ^4.0.1 => 4.0.1 gatsby-plugin-react-helmet: ^3.1.23 => 3.1.23 gatsby-plugin-robots-txt: ^1.5.0 => 1.5.0 gatsby-plugin-sass: ^2.1.26 => 2.1.30 gatsby-plugin-sharp: ^2.4.12 => 2.4.12 gatsby-plugin-sitemap: ^2.2.29 => 2.2.29 gatsby-plugin-typescript: ^2.2.3 => 2.2.3 gatsby-remark-copy-linked-files: ^2.1.39 => 2.1.39 gatsby-remark-images: ^3.1.49 => 3.1.49 gatsby-remark-prismjs: ^3.3.35 => 3.3.35 gatsby-remark-responsive-iframe: ^2.2.33 => 2.2.33 gatsby-remark-smartypants: ^2.1.19 => 2.1.22 gatsby-source-filesystem: ^2.1.55 => 2.1.55 gatsby-transformer-json: ^2.2.22 => 2.2.27 gatsby-transformer-remark: ^2.6.58 => 2.6.58 gatsby-transformer-sharp: ^2.3.9 => 2.3.18

ascorbic commented 4 years ago

Hi. Thanks for the report. From the error message, this looks like an issue with gatsby-plugin-generate-typings. Could you file the issue there. If it turns out to be an issue with Gatsby then please do open a new ticket here and include the full plugin config and a link to the ticket on gatsby-plugin-generate-typings.