Issue with adding an embedded Studio in Next/Sanity site after updating to Studio v3.
Good news - you found it! The ECONNREFUSED ::1:3333 error is a classic symptom of having a redirect or configuration that's pointing to the old standalone Studio port (3333) instead of serving the embedded Studio through your Next.js app.
As the community member pointed out in that thread, the issue was in next.config.js - there was a leftover redirect to the previous studio path. When you embed Studio v3 in Next.js with basePath: "/studio" in your sanity.config.js, the Studio should be served through your Next.js dev server (port 3000), not as a separate process on port 3333.
Your configuration files look correct:
- You've got the proper
[[...index]].jscatch-all route in your pages directory - Your
sanity.config.jshasbasePath: "/studio"set correctly - You're using
<NextStudio config={config} />properly
Things to check:
- next.config.js - Remove any redirects or rewrites that point to
localhost:3333or reference your old studio setup - Make sure you're not running a separate
sanity devcommand - With an embedded studio, you only run your Next.js dev server - Environment variables - Verify your
NEXT_PUBLIC_SANITY_PROJECT_IDandNEXT_PUBLIC_SANITY_DATASETare set correctly in your.env.localfile
The sanity-template-nextjs-clean template you're following is a great reference. Just make sure you've completely removed any configuration from your previous Studio v2 setup that might be interfering.
If you're still seeing issues after cleaning up next.config.js, also check for any custom server configuration or proxy settings that might be redirecting studio requests.
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.