Home > front end >  Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error
Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error

Time:01-12

I received a github repo backup from somebody elses account. The project is running gatsby, sanity cms and is hosted via netlify. When I extract the archive and saving the folder locally, I am perfectly able to get the gatsby development server runnning just by doing "yarn install" and "yarn gatsby develop".

However, when I create a new repo and import the project to my github account, the development server is not running anymore. We tried it on several machines and we always get the same error in terminal trying "yarn gatsby develop".

success open and validate gatsby-configs - 0.131s
success load plugins - 2.486s
success onPreInit - 0.038s
success initialize cache - 0.009s
success copy gatsby files - 0.091s
info [sanity] Fetching remote GraphQL schema

ERROR #gatsby-source-sanity_drafts.10003

[sanity] The token specified is not valid or has been deleted

How is that possible? I tried to fix this for days but I don't get it. The only differnce between being able to run the dev server and this error is to save the code to github... Is it maybe some sort of routing problem in the gatsby-config.js?

Would appreciate your help a lot!

CodePudding user response:

It seems that you are missing the environment variables in your new projects so your Sanity configuration is not valid, hence Gatsby is not able to fetch the data from the sources.

There should be a .env.development or .env.production files in your original code placed in the root of the project.

  •  Tags:  
  • Related