
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see the issue! The problem is in your token configuration. You have:
token: <http://process.env.MY|process.env.MY>_SANITY_TOKEN,This syntax is incorrect. The token option expects a string value, but what you have there looks like it got mangled (possibly by a Slack auto-formatter turning it into a link). It should be:
token: process.env.MY_SANITY_TOKEN,Notice there are no angle brackets, no http://, and no pipe character - just the plain environment variable reference.
Your corrected plugin configuration should look like:
{
resolve: 'gatsby-source-sanity',
options: {
projectId: 'my-id',
dataset: 'production',
token: process.env.MY_SANITY_TOKEN,
},
}The validation error you're seeing ("child "error" fails because ["error" must be an object]") is Gatsby's way of saying the plugin options didn't validate correctly - in this case because the malformed token value caused the plugin initialization to fail.
A few additional tips for getting started with gatsby-source-sanity:
token option entirelywatchMode: true and overlayDrafts: true to your options (this requires a token with read permissions). The overlayDrafts feature lets you see draft content in development while keeping only published content in production.sanity graphql deploy in your studio folder. The gatsby-source-sanity plugin relies on this deployed GraphQL schema to work properly.Once you fix that token syntax, your build should work fine!
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