Gatsby: Error loading a result for the page query in "/" in development after successful built

Created on 25 Oct 2020  ·  14Comments  ·  Source: gatsbyjs/gatsby

Description

This is a very weird issue which has started occurring recently. The development sequence runs successfully and I see the message:

You can now view website in the browser.
⠀
  http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
  http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use gatsby build
⠀
success Building development bundle - 10.845s

When I go to http://localhost:8000/ and hit enter, I receive the following:

Error loading a result for the page query in "/". Query was not run and no cached result was found.
Error loading a result for the page query in "/404.html". Query was not run and no cached result was found.
Error loading a result for the page query in "/dev-404-page". Query was not run and no cached result was found.

I've discovered by luck that if I wait around 5-10 mins, it starts to work. So I can visit / and other pages. But in the meantime, there are no messages or log into the terminal. As if there is a background process running. I've also noticed my Netlify deployments started to go up to 20 mins from the usual 4-5 minutes it takes. I guess Netlify is polling on index page and deploys when it gets a 200.

Steps to reproduce

Really don't know how to reproduce and what is causing this.

Expected result

To be able to navigate to / once build is successful.

Actual result

Error loading a result for the page query in "/". Query was not run and no cached result was found.

for around 10 mins, then it resumes normally.

Environment

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.asdf/installs/nodejs/12.13.1/bin/node
    Yarn: 1.22.4 - ~/.asdf/shims/yarn
    npm: 6.12.1 - ~/.asdf/installs/nodejs/12.13.1/bin/npm
  Languages:
    Python: 3.7.2 - ~/.asdf/shims/python
  Browsers:
    Chrome: 86.0.4240.111
    Edge: 86.0.622.51
    Firefox: 79.0
    Safari: 14.0
  npmPackages:
    gatsby: ^2.24.85 => 2.24.85
    gatsby-image: ^2.4.21 => 2.4.21
    gatsby-plugin-fullstory: ^2.3.14 => 2.3.14
    gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1
    gatsby-plugin-google-tagmanager: ^2.3.16 => 2.3.16
    gatsby-plugin-manifest: ^2.4.35 => 2.4.35
    gatsby-plugin-preload-fonts: ^1.2.28 => 1.2.28
    gatsby-plugin-react-helmet: ^3.3.14 => 3.3.14
    gatsby-plugin-sharp: ^2.6.43 => 2.6.43
    gatsby-plugin-sitemap: ^2.4.17 => 2.4.17
    gatsby-plugin-theme-ui: ^0.3.0 => 0.3.0
    gatsby-source-filesystem: ^2.3.35 => 2.3.35
    gatsby-source-prismic: ^3.1.4 => 3.2.1
    gatsby-transformer-sharp: ^2.5.19 => 2.5.19
  npmGlobalPackages:
    gatsby-cli: 2.12.111
needs reproduction bug

Most helpful comment

I am experiencing this same error since the latest Gatsby update. I tried Gatsby clean to clear the cache but that had no effect.

All 14 comments

I am experiencing this same error since the latest Gatsby update. I tried Gatsby clean to clear the cache but that had no effect.

Hi @fredshevek and @OlBal !

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

Hi @vladar

Thanks for getting back. I'll see if I can create one.

@OlBal

Just wondered, how many pages you create programmatically?
I used to create around 8000 pages in the exports.createPages hook with createPage action.

I've changed them to dynamic pages, so not compiling them at build time now. And the issue is no longer happening. So I suspect it has something to do with the createPage action

@fredshevek

Honestly it was a 2 page site that was able to build and deploy up until a new update gave .cache errors which I fixed then it's struggled with finding page querys. I'll take a look later on today and see if that helps. Thanks for the update.

I seem to have it working as a had a pathPrefix as part of my module exports in my gatsby.config file I forgot was there. So it was trying to query a path that doesn't exist anymore.

I'm running into the same issue on all paths since updating Gatsby from 2.21.0 to version 2.25.1.
ex. Error loading a result for the page query in "/dev-404-page". Query was not run and no cached result was found.
Has there been any movement on this?

I have had the same issue as well for over a month now. As a temporary solution I found, when I comment out some plugins from the gatsby-config file and restart my gatsby develop that it will start up without the error.

While this would point to a plugin being the issue, I've commented out various ones each time and it looks unrelated to the actual plugins and more around caching of the config file.

Did anyone reproduce this reliably? We would like to investigate this further but it is hard without at least some reproduction.

For other reasons, I moved away from programmatic createPage to dynamic pages. So this is no longer happening in my case. But as that was the change that stopped this happening, maybe that could shed some light on

I'm no longer experiencing this issue in the newest version of Gatsby - "^2.26.0", can anyone else confirm?

@NikkiJonesR I just tested "^2.26.0" on my project but no luck unfortunately. But good to know it fixed your issue, maybe it's a different package or config setting in my project.

Hi. I'm going to close this now, as we can't do much to help without a reproduction. If anybody is able to create a minimal reproduction for this using the latest gatsby then please do reopen the issue. Thanks!

We were having issues with this as well; I didn't have chance to make a reproduction, but we haven't noticed it since upgrading to v2.27.2.

This error popped up for me too.

Screen Shot 2020-12-19 at 5 20 58 PM

Here is my package.json info:

  "dependencies": {
    "@tailwindcss/postcss7-compat": "^2.0.2",
    "autoprefixer": "^9.8.6",
    "gatsby": "^2.29.1",
    "gatsby-awesome-pagination": "^0.3.6",
    "gatsby-image": "^2.8.0",
    "gatsby-plugin-feed": "^2.10.0",
    "gatsby-plugin-manifest": "^2.9.0",
    "gatsby-plugin-netlify": "^2.8.0",
    "gatsby-plugin-postcss": "^2.3.13",
    "gatsby-plugin-react-helmet": "^3.7.0",
    "gatsby-plugin-remove-serviceworker": "^1.0.0",
    "gatsby-plugin-sharp": "^2.11.1",
    "gatsby-plugin-typography": "^2.9.0",
    "gatsby-remark-copy-linked-files": "^2.7.0",
    "gatsby-remark-images": "^3.8.0",
    "gatsby-remark-prismjs": "^3.10.0",
    "gatsby-remark-responsive-iframe": "^2.8.0",
    "gatsby-remark-smartypants": "^2.7.0",
    "gatsby-source-filesystem": "^2.8.0",
    "gatsby-transformer-remark": "^2.13.0",
    "gatsby-transformer-sharp": "^2.9.0",
    "postcss": "^7.0.35",
    "prismjs": "^1.22.0",
    "react": "^16.14.0",
    "react-dom": "^16.14.0",
    "react-helmet": "^5.2.1",
    "react-pro-sidebar": "^0.4.4",
    "react-typography": "^0.16.19",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
    "typography": "^0.16.19",
    "typography-theme-wordpress-2016": "^0.16.19"
  },
  "devDependencies": {
    "eslint": "^7.16.0",
    "eslint-config-airbnb": "^18.2.1",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-jsx-a11y": "^6.4.1",
    "eslint-plugin-react": "^7.21.5",
    "eslint-plugin-react-hooks": "^4.2.0",
    "prettier": "2.1.1"
  },

I took a stab at creating a minimal reproduction to recreate the errors. Of course, after setting it up the error went away on my initial project and I could not get it to occur in the minimal repo I spun up.

https://github.com/Isaac-Tait/bug-repro-gatsbyjs

Figured I would post here just in case anybody can use my minimal reproduction and to say that the error is still happening with gatsby 2.29.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

totsteps picture totsteps  ·  3Comments

rossPatton picture rossPatton  ·  3Comments

magicly picture magicly  ·  3Comments

andykais picture andykais  ·  3Comments

KyleAMathews picture KyleAMathews  ·  3Comments