Discussion about deploying Sanity Studio with Vercel and encountering issues.

20 replies
Last updated: Feb 24, 2022
Any update on this?
AI Update

I'd be happy to help, but I need more context about what "this" refers to. Your question doesn't include enough information for me to provide a specific update.

If you're asking about:

  • A specific Sanity feature or issue - please let me know which feature, GitHub issue, or roadmap item you're referring to
  • A previous conversation - I don't have access to prior chat history, so please include the relevant details
  • A bug or feature request - share the GitHub issue number or describe what you're waiting on
  • Documentation or guide - let me know what topic you're looking for updates about

For the most up-to-date information on Sanity features and releases, I recommend:

Feel free to provide more details about what you're looking for, and I'll be able to give you a more specific answer!

Good day, User. Instead of the build
dist
directory, try either leaving root directory blank if you’re deploying your studio directly or entering the directory where your
studio.json
and
package.json
are located
user U
I have removed and left Root Directory empty now. When deploying with
with


{
  "version": 2,
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}
I get a 404 on launch doesn’t work. So I need to specify project folder in package.json?
I’ve had a lot of success just going over the basic sanity studio + vercel instructions, so I’m using that as a guide. And I’m currently reviewing the recently published medium2.0 ISR youtube video from User. So I’ll publish this studio to vercel…

https://vercel.com/guides/deploying-sanity-studio-with-vercel
I’m not using any real monorepo methods, I just have two directories in my project - one for studio and one for frontend. Following instructions, I’ve created a
vercel.json
file in the studio root, added
public -y
to the build script in package.json. And added
@sanity/cli
as a dev dependency.
user U
Followed this tutorial did exactly the same but not working very weird….
Since I am not currently using lerna or package mgr features to actually merge the sites, they are simply TWO web projects nested in the same repo.
I am going to deploy JUST the studio for now, pointing the vercel deployment tool at my github repo and then setting the updated root directory in my case to
/studio


sanity cors add <https://your-url.vercel.app> --credentials
this is not an ideal way to manage front and backend sites in a single repo - but just for learning and testing should work well enough
and the cherry on top that I always tend to forget - is adding the cors address to my sanity project info, most handily via the cli in the command in my previous post
Also don’t forget• run studio build in your local environment just to be sure
• git add, commit, push — then actually run the vercel build

make sure you’re installing your deps into your studio packages and not global or frontend packages, the same with your vercel config, and like my screenshot above make sure that the vercel build is pointed at your studio directory if this is nested within a larger project repo or actual monorepo
here is the repo I just used to deploy if you’d like to compare: https://github.com/User/medium20
user U
Adding the Sanity CLI to package.json did the job.. it also took me like 2 minutes to deploy is that normal?
for the hobby vercel plan I assume I’m going to be in queue behind their premium clients and have sometimes had to wait a few minutes - that doesn’t seem too bad.
Ah that’s why its working now perfectly thanks!
You’ll only need to rebuild when you make studio or schema changes, and as document changes are coming from the sanity content cloud just like in your dev env these should be nearly as fast as each other.
I also see that you can connect a custom domain and path for the studio and Next JS website which is really nice!
for the hobby vercel plan I assume I’m going to be in queue behind their premium clients and have sometimes had to wait a few minutes - that doesn’t seem too bad.
Ah that’s why its working now perfectly thanks!
You’ll only need to rebuild when you make studio or schema changes, and as document changes are coming from the sanity content cloud just like in your dev env these should be nearly as fast as each other.
user U
this was very helpful for me as well. For some unknown reason, Sanity was deploying just fine on Vercel up until 2 days ago (2/22/22) whereupon every push would fail. I tried many things, and what solved it for me was running
sanity build
and then pushing that (while also ensuring Vercel had the default output set to
dist
.
oh that’s annoying. I deployed a studio build for a friend to vercel a few days ago and left automatic CICD from the repo on github running. We’ve been tinkering with it the last couple of days without problems. There are many moving parts, and while vercel is a partner - things can easily change and break. Please let us know with a new thread here in help if you have further issues. Thank you!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?