Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Hey all! I'm a Sanity newbie and trying to add Sanity to a Gatsby project I'm working on. I'm trying to add the gatsby-sanity-source plugin and when I try and build the project...

3 replies
Last updated: Jan 28, 2021
Hey all! I'm a Sanity newbie and trying to add Sanity to a Gatsby project I'm working on. I'm trying to add the gatsby-sanity-source plugin and when I try and build the project I get this gnarly error.

Failed to validate error Error [ValidationError]: child "error" fails because ["error" must be an object]

If I remove the plugin code from gatsby-config. It builds fine. The plugin objectlooks like this (I removed the projectId from this message):


{
resolve: 'gatsby-source-sanity',
options: {
projectId: 'my-id',
dataset: 'production',

// a token with read permissions is required

// if you have a private dataset

token: <http://process.env.MY|process.env.MY>_SANITY_TOKEN,

},

},

Any ideas what I'm missing?
Jan 28, 2021, 8:27 PM
I’m not too familiar with GraphQL, but did you run
sanity graphql deploy
?
Jan 28, 2021, 8:37 PM
Yea I would try what Geoff just said - especially since your trace is throwing this:
error: 'Error: GraphQL API not deployed - see <https://github.com/sanity-io/gatsby-source-sanity#graphql-api> for more info\n
Jan 28, 2021, 8:41 PM
Yup, that was it. I tried that yesterday and it came back and said that graphql wasn't an available switch (or something like that) for sanity.Anyways it worked now! Onward I go and THANK YOU!!
Jan 28, 2021, 8:54 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?