-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Parallel query running fails when querying JSON with custom type name #34610
Comments
We have the same problem running Gatby 4 in a GitHub action. Locally on Windows it was only reproduceable once, in all our other tests it worked. I assume it's a race-condition. |
Hi, thanks for the issue! Downloading your codesandbox as a zip, running it locally I also see this. At the moment I sadly don't have a hunch why that might happen. We saw this sometimes in our E2E tests, too, so I don't think this is specific to the JSON transformer. |
I spent some time investigating this over the last few days and I think I understand what's going on now. During schema building, Gatsby takes a snapshot of the schema and saves it to the cache. gatsby/packages/gatsby/src/schema/schema.js Lines 156 to 163 in 711a96f
It then uses that snapshot to populate the schema that parallel queries are run against. gatsby/packages/gatsby/src/utils/worker/child/schema.ts Lines 24 to 33 in 711a96f
The function that prints the schema includes a hardcoded list of internal types which are excluded from the output. gatsby/packages/gatsby/src/schema/print.ts Lines 344 to 359 in 711a96f
That list includes the type Json implements Node @childOf(types: ["File"]) @dontInfer {
apples: Int
oranges: Int
bananas: Int
} If I use a different value for the type name option when configuring the transformer plugin then this all works as expected. |
Thanks for taking a look @pieh! |
Preliminary Checks
Description
Parallel query running is failing on my site whilst trying to query the child JSON field of a file node. This only seems to happen when the type name option is set for gatsby-transformer-json
Reproduction Link
https://codesandbox.io/s/gatsby-json-pqr-wzdv5
Steps to Reproduce
Run
gatsby clean
followed bygatsby build
Expected Result
The build completes successfully
Actual Result
The build fails with the following errors
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: