Join live – Get insights, tips, + Q&A from Sanity developers on our latest releases

"Troubleshooting adding Sanity to a Gatsby project and resolving deployment and configuration issues."

12 replies
Last updated: Jul 19, 2021
Trying to add Sanity to a Gatsby project. I'm getting an error that says "GraphQL API not deployed." However, I have deployed it. The repo is here: https://github.com/ChrisWillburn/chris-willburn1 . Anyone know how I can get Sanity working on this project? It's been really frustrating to try and install Sanity, and it seems like it's taken way too long. It looks good and I want to use it, but so far...not so good.
Jul 19, 2021, 7:33 PM
Hey Kevin! Can you double check that your GraphQL API deployed properly by running
sanity graphql list
?
Jul 19, 2021, 7:47 PM
No problem! Here's the result:
Jul 19, 2021, 8:29 PM
Here are the GraphQL endpoints deployed for this project:1. Dataset: production
Tag: default
Generation: gen3
Playground: true
URL:
https://2poujhw5.api.sanity.io/v1/graphql/production/default
Jul 19, 2021, 8:29 PM
Ok, looking at the endpoint url then comparing it to your
gatsby-source-sanity
config , it looks like the project ids do not match. What happens if you change the config to reflect the endpoint’s id of
2poujhw5
?
Jul 19, 2021, 8:45 PM
That did it! Thank you! Couple more questions: a) I'm not sure what the admin link is to log in to Sanity, and b) will the blog show up at /blog?
Jul 19, 2021, 8:56 PM
Totally forgot to update the ID in gatsby-config.js! Great catch.
Jul 19, 2021, 9:01 PM
Nice! For your first question, I’m not 100% certain what you mean by admin link, but you can log into a project through manage.sanity.io , as well as find the url for the deployed studio. If you’re invited as an admin on the project, you’ll show up as an admin in the studio. Let me know if I’m misunderstanding your question, though!As for the blog, did you use a starter to create this or did you build it from scratch? If you used a starter, it should be configured to fetch all of your blog posts out of the box. If not, you would have to query your Sanity content in order to get the data into your FE.
Jul 19, 2021, 9:04 PM
By admin link, I mean where do I go to login and create content, i.e. yoursite.com/admin . I didn't use a starter, so I'll need to query it.
Jul 19, 2021, 9:07 PM
Got it. So, in order to create content (outside of running the studio on localhost using
sanity start
), you would need to run
sanity deploy
in the root of your studio folder. You’ll then be able to choose your
*.sanity.studio
url. If the studio has already been deployed, you’ll find that url under the project’s name at manage.sanity.io .
Jul 19, 2021, 9:14 PM
Thanks so much for all your help, Racheal! I should be able to finish this up now. I really appreciate it.
Jul 19, 2021, 9:15 PM
Happy to help!
Jul 19, 2021, 9:16 PM
Happy to help!
Jul 19, 2021, 9:16 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?