🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Issue with missing fields in local GraphQL schema when using gatsby-source-sanity.

8 replies
Last updated: Dec 8, 2021
Cannot query field [field] on type [type]
. Bumping this in hopes to get some help, several of us are dead in the water. I'm struggling to figure out if this is related to
gatsby
or
gatsby-source-sanity
or
sanity
.

https://sanity-io-land.slack.com/archives/C9Z7RC3V1/p1638291184045400
Dec 5, 2021, 3:18 PM
user B
Could this be caused by
gatsby-source-sanity
? I don't see how this could be a graphql issue since
gatsby build
works but
gatsby develop
is failing. It's as if the local graphql instance is missing some fields from the Sanity schema.
I've tested with the last few versions up to
"gatsby-source-sanity": "^7.3.0-previews.3"


https://jmp.sh/gdSuKPM
Dec 5, 2021, 3:46 PM
Another data point, my deployed GraphQL Schema seems in good order (has the right fields) whereas the local schema seems to be missing fields (hence the error).
https://jmp.sh/0lwgIMK
Dec 6, 2021, 1:30 AM
I'll circle back to this tomorrow - in the meantime perhaps could you use
7.2.0
to unblock your work? Also, did you get a chance to try
7.3.0
instead of the
-previews
versions?
Thanks for being so thorough and active in your reports, User!
Dec 6, 2021, 12:34 PM
Thanks
user B
. So that is one of the baffling things about this issue, I did revert to
7.2.0
but the problem persisted (even cleared NPM). This is one of the things that's making is hard to know where the root cause lies. LMK if there is any other info I can provide to help trouble shoot. I appreciate your help.
Dec 6, 2021, 3:34 PM
user B
I apologize for the red herring but I figured out my issue and it was a misconfiguration on my end. As part of the Gatsby v4/Preview/gatsby-source-sanity update, I switched to using a
client-config.js
file and it was referencing the wrong env var which caused it to use the wrong sanity dataset.
You can ignore this issue.
Dec 6, 2021, 7:12 PM
No need to apologize! We should've had a better debugging experience for you to ensure you find misconfiguration before it hits you on the foot like that.
Do you think proactively logging the plugin configuration at the start
gatsby develop
could help, or would it just add more noise to the console?
Dec 7, 2021, 11:52 AM
I appreciate the extreme ownership
user B
but I think this one is just on me. I actually use to console lot out my current env and coincidentally I removed that along with this change because I felt I hadn't used it enough which was a dumb thing for me to do. Thanks for your time.
Dec 8, 2021, 11:39 PM
I appreciate the extreme ownership
user B
but I think this one is just on me. I actually use to console lot out my current env and coincidentally I removed that along with this change because I felt I hadn't used it enough which was a dumb thing for me to do. Thanks for your time.
Dec 8, 2021, 11:39 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?