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

"WebpackError: The result of this StaticQuery could not be fetched" only on Macbook #36520

Closed Virakal closed 2 years ago

Virakal commented 2 years ago

Preliminary Checks

Description

We have a Gatsby setup using a WordPress source that has been working for us until my colleague got a new laptop. On the new laptop he is seeing the following error, which says it is an issue with Gatsby and to report it here:

yarn build

 ERROR

(node:87509) [DEP0128] DeprecationWarning: Invalid 'main' field in
'/Users/jonathanporter/Sites/icare-dementia/i-care-dementia/node_modules/gatsby-word
press-inline-images/package.json' of 'n/a'. Please either fix that or report it to
the module author
(Use `node --trace-deprecation ...` to show where the warning was created)

success open and validate gatsby-configs, load plugins - 0.950s
success onPreInit - 0.020s
success initialize cache - 0.005s
success copy gatsby files - 0.047s
success Compiling Gatsby Functions - 0.134s
success onPreBootstrap - 0.147s
success  gatsby-source-wordpress  ensuring plugin requirements are met - 0.014s
success  gatsby-source-wordpress  diff schemas - 5.668s
success  gatsby-source-wordpress  ingest WPGraphQL schema - 5.716s
success createSchemaCustomization - 5.771s
success  gatsby-source-wordpress  pull updates since last build - 0.990s
success  gatsby-source-wordpress  fetch root fields - 1.128s
warn The gatsby-wordpress-inline-images plugin has generated no Gatsby nodes. Do you
 need it?
success Checking for changed pages - 0.001s
success source and transform nodes - 1.196s
success building schema - 0.404s
success createPages - 0.087s
success createPagesStatefully - 0.021s
info Total nodes: 1014, SitePage nodes: 391 (use --verbose for breakdown)
success Checking for changed pages - 0.003s
success Cleaning up stale page-data - 0.024s
success update schema - 0.074s
success onPreExtractQueries - 0.001s
success extract queries from components - 0.342s
success write out redirect data - 0.001s
warn The icon(content/assets/icare-icon-783.png) you provided to
'gatsby-plugin-manifest' is not square.
The icons we generate will be square and for the best results we recommend you
provide a square icon.

success Build manifest and related icons - 0.035s
success onPostBootstrap - 0.058s
info bootstrap finished - 10.704s
success run page queries - 0.005s - 2/2 381.65/s
success write out requires - 0.004s
warn Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
⠴ Building production JavaScript and CSS bundles
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
success Building production JavaScript and CSS bundles - 4.722s
success Writing page-data.json files to public directory - 0.010s - 2/2 198.74/s
success Building HTML renderer - 1.009s

 ERROR

Page data from page-data.json for the failed page
"/en/self-care-emotions-management/5-senses-grounding-exercise/": {
  "componentChunkName": "component---src-templates-section-js",
  "path": "/en/self-care-emotions-management/5-senses-grounding-exercise/",
  "result": {
    "data": {
      "post": {
        "id": "cG9zdDo2OTQ=",
        "content": "\n<p>Engaging our senses, grounding ourselves by connecting to
the present moment and our present experiences, can be really useful. When you are
feeling anxious, distressed or agitated, try out the following
exercise:</p>\n\n\n\n<p>(If your mind start...",
        "title": "5 Senses Grounding Exercise",
        "menuOrder": null,
        "parent": {
          "node": {
            "uri": "/en/self-care-emotions-management/",
            "slug": "self-care-emotions-management",
            "menuOrder": 9,
            "wpChildren": {
              "nodes": [
                {
                  "uri":
"/en/self-care-emotions-management/5-senses-grounding-exercise/",
                  "title": "5 Senses Grounding Exercise",
                  "menuOrder": null
                },
                {
                  "uri": "/en/self-care-emotions-management/stressed-stop/",
                  "title": "Stressed? STOP!",
                  "menuOrder": 1
                }
              ]
            },
            "parent": {
              "node": {
                "lang": "en",
                "wpChildren": {
                  "nodes": [
                    {
                      "uri": "/en/search/",
                      "title": "Search",
                      "menuOrder": 2
                    },
                    {
                      "uri": "/en/dementia-screening-diagnosis/",
                      "title": "Dementia Screening & Diagnosis",
                      "menuOrder": 18
                    },
                    {
                      "uri": "/en/best-interest-decisions/",
                      "title": "Best Interest Decisions",
                      "menuOrder": 17
                    },
                    {
                      "uri": "/en/mental-capacity/",
                      "title": "Mental Capacity Assessment",
                      "menuOrder": 16
                    },
                    {
                      "uri": "/en/covid-19/",
                      "title": "COVID-19 & Dementia",
                      "menuOrder": 15
                    },
                    {
                      "uri": "/en/effective-care-planning-in-dementia/",
                      "title": "Effective Care Planning in Dementia",
                      "menuOrder": 13
                    },
                    {
                      "uri": "/en/physical-health/",
                      "title": "Physical Health & Dementia",
                      "menuOrder": 12
                    },
                    {
                      "uri": "/en/diagnostic-overshadowing/",
                      "title": "Diagnostic Overshadowing",
                      "menuOrder": 11
                    },
                    {
                      "uri": "/en/psychological-first-aid/",
                      "title": "Psychological First Aid",
                      "menuOrder": 10
                    },
                    {
                      "uri": "/en/activity-in-dementia/",
                      "title": "Activity in Dementia",
                      "menuOrder": 7
                    },
                    {
                      "uri": "/en/effective-communication/",
                      "title": "Effective Communication in Dementia",
                      "menuOrder": 14
                    },
                    {
                      "uri": "/en/self-care-emotions-management/",
                      "title": "Self-Care & Emotions Management",
                      "menuOrder": 9
                    },
                    {
                      "uri": "/en/documenting-analysing-behaviours/",
                      "title": "Documenting & Analysing Behaviours",
                      "menuOrder": 8
                    },
                    {
                      "uri": "/en/delirium/",
                      "title": "Delirium",
                      "menuOrder": 6
                    },
                    {
                      "uri": "/en/behaviour-that-challenges-in-dementia/",
                      "title": "Behaviour that Challenges in Dementia",
                      "menuOrder": 5
                    },
                    {
                      "uri": "/en/medication-and-side-effects/",
                      "title": "Medication and Side Effects",
                      "menuOrder": 4
                    },
                    {
                      "uri": "/en/types-of-dementia/",
                      "title": "Types of Dementia",
                      "menuOrder": 3
                    },
                    {
                      "uri": "/en/contacts/",
                      "title": "Useful Contacts for Dementia Support",
                      "menuOrder": 1
                    },
                    {
                      "uri": "/en/about/",
                      "title": "About",
                      "menuOrder": null
                    }
                  ]
                }
              }
            }
          }
        },
        "sectionIndexLinks": {
          "nodes": []
        },
        "sectionLink": {
          "node": {
            "menuOrder": 9,
            "wpChildren": {
              "nodes": [
                {
                  "uri":
"/en/self-care-emotions-management/5-senses-grounding-exercise/",
                  "title": "5 Senses Grounding Exercise",
                  "menuOrder": null
                },
                {
                  "uri": "/en/self-care-emotions-management/stressed-stop/",
                  "title": "Stressed? STOP!",
                  "menuOrder": 1
                }
              ]
            }
          }
        },
        "featuredImage": null
      }
    },
    "pageContext": {
      "id": "cG9zdDo2OTQ=",
      "previousPostId": "cG9zdDozMTcw",
      "nextPostId": "cG9zdDoyMzkw"
    }
  },
  "staticQueryHashes": [
    "1197826958",
    "1792165606",
    "2664321433",
    "2871720042",
    "3217051006",
    "922135737"
  ]
}

failed Building static HTML for pages - 0.528s

 ERROR #95313

Building static HTML failed for path
"/en/self-care-emotions-management/5-senses-grounding-exercise/"

See our docs page for more info on this error: https://gatsby.dev/debug-html

  75 |     return context[query].data
  76 |   } else {
> 77 |     throw new Error(
     |           ^
  78 |       `The result of this StaticQuery could not be fetched.\n\n` +
  79 |         `This is likely a bug in Gatsby and if refreshing the page does not
fix it, ` +
  80 |         `please open an issue in https://github.com/gatsbyjs/gatsby/issues`

  WebpackError: The result of this StaticQuery could not be fetched.

  - gatsby-browser-entry.js:77
    dementia-awareness/.cache/gatsby-browser-entry.js:77:11

  - Seo.js:18
    dementia-awareness/src/components/Seo.js:18:40

  - static-entry.js:286
    dementia-awareness/.cache/static-entry.js:286:22

not finished Caching JavaScript and CSS webpack compilation - 1.679s
not finished Caching HTML renderer compilation - 0.558s

The query causing the error is:

query {
  wp {
    generalSettings {
      title
      description
    }
  }

  wpUser {
    twitter: name
  }
}

The query runs fine for me if I run it on the GraphQL IDE but I'm unable to confirm if it does for my colleague because they aren't able to access the IDE without a successful build. We aren't seeing an PHP errors that might indicate an issue with the WordPress source. Not sure if it's relevant but the laptop is an M1 Macbook, whereas I've had it run successfully on Windows, Linux and regular OS X. The page that the error occurs on changes for every build.

Reproduction Link

Unable to reproduce

Steps to Reproduce

Run gatsby develop or gatsby build on an M1 Macbook

Expected Result

Successful build

Actual Result

Build error, shown above.

Environment

  System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /private/var/folders/n8/fqnkk7nd4s5f15t7m0p13j
c40000gn/T/xfs-c8b1ead9/node
    Yarn: 3.2.0 - /private/var/folders/n8/fqnkk7nd4s5f15t7m0p13jc4
0000gn/T/xfs-c8b1ead9/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Browsers:
    Chrome: 105.0.5195.52
    Firefox: 104.0
    Safari: 15.4
  npmPackages:
    gatsby: ^3.10.1 => 3.14.6
    gatsby-image: ^3.10.0 => 3.11.0
    gatsby-plugin-i18n: ^1.0.1 => 1.0.1
    gatsby-plugin-manifest: ^3.10.0 => 3.14.0
    gatsby-plugin-offline: ^4.10.0 => 4.14.0
    gatsby-plugin-react-helmet: ^4.10.0 => 4.14.0
    gatsby-plugin-s3: ^0.3.8 => 0.3.8
    gatsby-plugin-sharp: ^3.10.2 => 3.14.3
    gatsby-plugin-styled-components: ^4.10.0 => 4.14.0
    gatsby-source-filesystem: ^3.10.0 => 3.14.0
    gatsby-source-wordpress: ^5.10.0 => 5.14.2
    gatsby-transformer-sharp: ^3.10.0 => 3.14.0
    gatsby-wordpress-inline-images: ^1.2.1 => 1.2.1

Config Flags

No response

marvinjude commented 2 years ago

Hi @Virakal ,

I'm sorry this is happening. We'd need a minimal reproduction to be able to effectively debug this as the error log doesn't provide sufficient info that can assist us in debugging this.

Virakal commented 2 years ago

Hi @marvinjude.

Unfortunately we've not been able to figure out enough to reproduce this, and it's stopped happening. I'm afraid I'm not sure what fixed it, either.

marvinjude commented 2 years ago

Hi @Virakal,

Thanks a lot for reporting back! I'll close this issue since you can't reproduce it anymore. Please feel free to open a new issue with minimal reproduction if you happen to run into this in the future.

Thanks for using Gatsby! 💜