Issues with deploying GraphQL and adding a YouTube block to a basic blog post in Sanity/Gatsby tutorial.

12 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 < >", "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
- 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
Hey I have another question ... do you know how I can successfully add a youtube block to the basic blog post (meaning the basic blog set up via this tutorial: )?
I've followed this tutorial on adding a rich text field to a post: And this tutorial on making a youtube input field with preview:
I added a rich text field to my post.js script with:
name: 'Richbody',
type: 'richText',
title: 'Body text',

And in richText.js I have:
type: 'youtube',
Sep 23, 2020, 6:00 PM
In youtube.js I have the code from the tutorial on making a youtube input field mentioned above. The youtube embed shows in my localhost studio, but when I try to publish, I keep getting this error:
Error: Unknown block type "youtube", please specify a serializer for it in the 'serializers.types' prop
Sep 23, 2020, 6:03 PM
I've also tried bypassing the rich text field and adding:
name: 'YouTube',
type: 'youtube',
title: 'Youtube Embed'

And get this error:

An error occured: Could not find schema type for block element of _type youtubeCheck your browser's JavaScript console for details.
Sep 23, 2020, 6:16 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?