
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI feel your frustration - this is actually a common issue that trips people up! The good news is it's usually fixable with a few specific steps. Let me walk you through the most likely causes and solutions.
When you see your Sanity data in the GraphQL Playground but not in Gatsby's GraphiQL, it means the gatsby-source-sanity plugin isn't successfully fetching your schema or data. Here's what's likely happening:
This is the #1 fix. Gatsby caches GraphQL schemas aggressively, and sometimes doesn't pick up changes:
gatsby clean
gatsby developThis clears .cache and public folders and forces Gatsby to re-fetch everything from Sanity.
Double-check your configuration has all required fields:
{
resolve: 'gatsby-source-sanity',
options: {
projectId: 'your-project-id',
dataset: 'production', // or your dataset name
token: process.env.SANITY_TOKEN, // if using private dataset
watchMode: true, // enables hot-reloading in dev
overlayDrafts: true, // if you want to see drafts
}
}Add an apiVersion to your config - this is often the culprit:
{
resolve: 'gatsby-source-sanity',
options: {
projectId: 'your-project-id',
dataset: 'production',
apiVersion: '2023-05-03', // Use today's date in YYYY-MM-DD format
// ... other options
}
}If you're using a token (required for private datasets or overlayDrafts):
console.log(process.env.SANITY_TOKEN) temporarily)Run this in your Sanity studio folder:
sanity graphql deployThen check if the deployment was successful by visiting your GraphQL Playground at https://YOUR-PROJECT-ID.api.sanity.io/v1/graphql/DATASET/default
Set this environment variable to see what gatsby-source-sanity is doing:
SANITY_DEBUG=true gatsby developThis will show you detailed logs about what the plugin is fetching and any errors it encounters.
If you're seeing different type names than expected, check if you have a typePrefix option in your config. By default, Gatsby prefixes all Sanity types with "Sanity" (hence allSanityHomepage). If you've changed this, your queries would need to match.
Since you mentioned this happened when launching to Netlify, check:
SANITY_TOKEN present in Netlify if you're using overlayDrafts or a private dataset?gatsby clean && gatsby developapiVersion to gatsby-config.jssanity graphql deploy in studio folderSANITY_DEBUG=true gatsby develop to see errorsThe fact that your GraphQL Playground works means your Sanity setup is fine - this is purely a Gatsby-side connection issue. Start with the cache clear and apiVersion addition, as those fix 90% of these cases.
Let us know if you're still stuck after trying these steps!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store