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

GraphQL query resolving references on a _raw field in Gatsby

2 replies
Last updated: May 17, 2022

Hey all, if within a gatsby project I remove the node_modules and reinstall them I must clear the gatsby cache in order for Mux video to work. I've noticed that when using the GraphiQL interface and I do a graphQL query resolving references on a _raw field if I don't clear the cache the reference then the 'asset' comes back null. As soon as I

gatsby clean
and re-run the same query, the 'asset' field gets populated with all the mux data.
Anyone any idea why this might be happening?

May 17, 2022, 9:15 AM

I’ve also been having this problem, I think it’s a bug in version

7.4.2
as downgrading to
7.4.1
seems to solve it for me. Someone else has opened an issue on Github about this too: https://github.com/sanity-io/gatsby-source-sanity/issues/154

May 17, 2022, 11:20 AM

Thanks Simon. I'll take a look.

May 17, 2022, 8:01 PM

Sanity.io: Get the most out of your content

Sanity.io 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.