Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

CannotQuery Field [Field] on type [Type]

3 replies
Last updated: Dec 6, 2021

Consistently getting a "Cannot query field [field] on type [Type]." when I add new fields to an object. Can't see anything which changed before this that could cause it. Any ideas?

Nov 22, 2021, 5:12 PM

Did you change the name of the sanity dataset? I had the same error but on dev it worked as it pulled the correct one, but build was still using the the “old” dataset.

Dec 6, 2021, 10:47 AM

Also I sometimes forget to CTRL+C when changing the graphql.
As for the fields you also need to “sanity graphql deploy” each time you add new objects or documents to the schema.

Dec 6, 2021, 10:49 AM

Noooo of course this is it! So yes, I was changing between multiple datasets and not deploying the dataset I was consuming! Such a dumb mistake, but thanks for bringing up datasets.

Dec 6, 2021, 5:24 PM Get the most out of your content is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.