Closed liana-p closed 3 years ago
Linking relevant other issues in case my discovery about the feed plugin helps someone:
Hi!
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.
The feed plugin doesn't have a static query so it can't be the reason for what you're seeing.
Same error, I think the error is happened at html
field. I don't know why now.
Hi!
Since we didn't receive an answer for 7 days or more about the ask of a reproduction I'm going to close this now, as we can't do much to help without a reproduction. If you are able to create a minimal reproduction for this then please do answer here or open a new issue with a reproduction. Thanks!
Here's my reproduction: https://github.com/jsg2021/gatsby-staticquery-error-repro
npm start
runs just fine. npm run build
fails.
I am also getting the same error and can't solve it properly. The only way I can get around this is by running npx gatsby clean every few changes.....
Facing the exact same issue. Using plugin-mdx with plugin-feed seems to cause this error. Commenting out the feed in gatsby-config.js file makes the error disappear. I'm running the latest Gatsby version
Mixing gatsby-plugin-mdx
and gatsby-plugin-feed
trigger this
@LekoArts I think this issue should be reopened. The original author seems to have provided the reproduction link. I have also been facing the same issue here likely due to something going wrong by mixing the plugin-mdx and the plugin-feed.
Preliminary Checks
Description
I am getting this error:
The error is coming from code inside
gatsby-plugin-mdx
in thegatsby-browser-entry.js
fileThis started happening specifically after a commit where I migrated from remark to mdx. I added the mdx plugin and removed the remark one. You can see that the error happens from some code inside the mdx plugin.
Fixes I have tried (from the other very long threads of people having similar issues:
useStaticQuery
, the version in a separate hook function, and the<StaticQuery>
componentgatsby-plugin-graphql-codegen
plugin as I saw a thread mentioning it as an issueBasically nothing worked. There are many threads about the same issue, for some people just clearing the cache worked, for some others nothing did. What I do know is that for me everything was fine until I started using the
mdx
plugin.Then I noticed that the
gatsby-plugin-feed
in the config had a static query inside (again, this is from the official blog template so I didn't even write this myself) and I remembered seeing something about how there can't be two queries in one page.I tried commenting out the whole plugin and it worked. So there is an issue that only happens with the mdx plugin.
I don't really have more details than that and I don't know why the mdx plugin causes this error while remark was fine, my only assumption is that having the query in the field plugin causes two static queries to happen and breaks something.
Posting my
gatsby-config.js
to help figure out the issue:My static queries in the rest of the code are the default ones from the blog template, and even completely removing them from the codebase makes this bug still happens so I think the code is irrelevant, this config alone will break things.
Reproduction Link
https://github.com/gatsbyjs/gatsby/issues/24902
Steps to Reproduce
gatsby build
Expected Result
The build works
Actual Result
The build errors
Environment
Config Flags
No response