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

Issue with deploying GraphQL in Sanity/Gatsby tutorial, resolved with updated script

9 replies
Last updated: Sep 23, 2020
Hi all! I'm following along the first steps w Sanity/Gatsby blog tutorial and running into an issue with deploying graph-ql: whenever I command "npm run graphql-deploy" my terminal hangs on "lerna info Executing command in 1 package: "npm run graphql-deploy"" ... Anyone know why that may be happening?
Sep 23, 2020, 1:16 PM
can you paste the scrips in your package.json for your root folder and studio folder here?
Sep 23, 2020, 1:23 PM
Root folder:
{
"private": true,
"name": "sanity-gatsby-blog",
"version": "1.0.16",
"scripts": {
"build": "lerna run build --parallel",
"dev": "lerna run dev --parallel",
"format": "lerna run format",
"build-studio": "lerna bootstrap && cd studio && npm run build",
"build-web": "lerna bootstrap && (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)",
"graphql-deploy": "lerna run graphql-deploy",
"lint": "lerna run lint",
"postinstall": "lerna bootstrap",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"
user U
/cli": "^1.150.1", "lerna": "^3.13.1"
}
}

Studio folder:

{
"private": true,
"name": "sanity-gatsby-blog-studio",
"version": "1.0.11",
"main": "package.json",
"author": "Sanity <
hello@sanity.io >", "scripts": {
"dev": "sanity start",
"format": "prettier-eslint --write \"**/*.js\" \"!node_modules/**\"",
"build": "sanity build",
"graphql-deploy": "sanity graphql deploy --playground",
"lint": "eslint .",
"test": "sanity check"
},
"dependencies": {
"
user U
/base": "^1.150", "
user U
/cli": "^1.150", "
user U
/components": "^1.150", "
user U
/core": "^1.150", "
user U
/dashboard": "^1.150", "
user U
/default-layout": "^1.150", "
user U
/default-login": "^1.150", "
user U
/desk-tool": "^1.150", "
user U
/studio-hints": "^1.150", "date-fns": "^1.30.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"sanity-plugin-dashboard-widget-document-list": "^0.0.11",
"sanity-plugin-dashboard-widget-netlify": "^1.0.1"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-config-standard-react": "^7.0.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-standard": "^4.0.0",
"prettier-eslint-cli": "^4.7.1"
}
}
Sep 23, 2020, 1:26 PM
ah they didn't change the starter's script for graphql-deploy... they have updated the graphql to a new version so the new graphql-deploy script in your studio should read
"graphql-deploy": "sanity graphql deploy --generation gen2",
Sep 23, 2020, 1:28 PM
thanks for the quick reply. hmm i'm still getting the same issue after updating the script. does it matter that my terminal says "lerna notice cli v3.22.0" while my root folder package.json script has "lerna": "^3.13.1" ?
Sep 23, 2020, 1:36 PM
Hi Lucas, thanks for reporting! We’ll check this out. In the meantime, could you try running
sanity graphql deploy
from the /studio folder instead?
Sep 23, 2020, 1:45 PM
Thanks Peter! What would you recommend I answer these questions with?
Sep 23, 2020, 2:13 PM
You can confirm these with
y
- it’s to warn you that there were changes in your schema 🙂
Sep 23, 2020, 2:16 PM
Awesome gotcha haha was j worried by the word "dangerous". All is looking good! Thanks for the help 🌅
Sep 23, 2020, 2:19 PM
We could probably hit a slightly less alarming tone there, thanks for the feedback! 🙂
Sep 23, 2020, 2:41 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?