Unlock seamless workflows and faster delivery with our latest releases – get the details

How to deploy embedded Sanity Studio and resolve ID error.

12 replies
Last updated: Aug 23, 2023
Hello everyone,
Does anyone know how to deploy embedded sanity studio? I have access to it now running at
http://localhost:3000/studio .
Aug 22, 2023, 10:26 PM
from your root directory if you use
sanity deploy
from the cli that has worked for me :)
Aug 22, 2023, 10:53 PM
Thank you (Removed Name)) I used
npx sanity deploy
and it was built but I get an error Something wrong with my ID. This is my first Sanity Deployment.
Aug 22, 2023, 11:04 PM
I will be happy to hear any recommendations
Aug 22, 2023, 11:04 PM
I have .env.local file with project id inside as a variable.
Aug 22, 2023, 11:05 PM
I had this issue too — in my sanity.config.js I had to add the dataset and projectId more explicitly like this:
import { projectId, dataset } from “./sanity/env”

export default defineConfig({
projectId: projectId,
dataset: dataset,
basePath: ‘/studio’,
// etc
Aug 22, 2023, 11:09 PM
Let me know if that works. Also, you will need to add those env variables to your Vercel project’s environment variables
Aug 22, 2023, 11:10 PM
Thank you so much, will try. Also I have a question: did you type your deployed project url after you run
sanity deploy
?
Aug 22, 2023, 11:12 PM
Happy to help :) Yes, I did — in my terminal when prompted I added the project url, like sanityproject.sanity.studio (you only need to add that first part before sanity). You can also undeploy and redeploy later if you decide to change the deployed url address.
Aug 22, 2023, 11:32 PM
user C
I undeployed it and checked the url of my deployed project with
/studio
- at the end -> it is working without cms deployment. Only we need to deploy the front-end project itself if we have cms embeded.
Aug 23, 2023, 3:35 PM
Hello
user N
Sorry, yes, now that I read your question again I understand. That’s true that because the studio is embedded, you will need to deploy the frontend to be able to use the
/studio
url route. It was late here when I answered last night 😅 If you would rather have a separate deployment for the studio (not embedded), you can still do that with a separate sanity directory inside your project.
Aug 23, 2023, 3:51 PM
Are you planning to deploy with Vercel? Let me know if you need any help 🙂
Aug 23, 2023, 3:52 PM
Thank you so much) 🙂
Aug 23, 2023, 4:04 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?