Tips for running a Studio locally with the Netlify CLI and resolving CORS error.
Last updated: Mar 20, 2021
Anyone have tips for running a Studio locally with the netlify CLI? I want to ship functions with the studio and need to develop them locally, but I get a "Not Found" printed in the DOM (no console errs) when running "netlify dev" in the studio root. Here's the netlify.toml
from = "/*"
to = "/"
status = 200
functions = "functions"
base = "studio"
publish = "studio/dist"
command = "npm run build"
Feb 28, 2021, 6:53 PM
Hi!The Netlify CLI can automatically identify the framework used. But Sanity is not on the list. You need to add the configuration manually to netlify.toml, something like this
Finally getting back to this project and I'm a bit confused as to how the netlify dev environment is supposed to have sanity/core installed in order to run sanity start?
the config you sent is definitely appropriate and starts up the server, but then I see this error
@sanity/core not installed in current project
Project-specific commands not available until you run `sanity install`
Error: "start" is not available outside of a Sanity project context.
Run the command again within a Sanity project directory, where "@sanity/core"
is installed as a dependency.
Mar 20, 2021, 3:15 AM
strange, I've just tried running ntl dev and it works for me. but I didn't try the serverless functions:
simply forgot to install dependancies 😅 got the studio running with Netlify CLI now, however I get a Sanity CORS error when trying to open the studio on the Netlify defined port (8888). I can open it through the targetPort (3333) though. I have both 8888 and 3333 defined in the Sanity API settings, but I'm still getting this cors error. Weird!
Mar 20, 2021, 7:21 PM
Moved localhost:8888 to "Allow Credentials" and got the studio to open properly! Thanks again