How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Sanity Studio v3 embedded in Next.js: Error ECONNREFUSED ::1:3333

3 repliesLast updated: Nov 29, 2025

Hi folks, long time listener, first time caller here. I’m working on a Next/Sanity site, and have just updated to Studio v3. I’m struggling a bit to add an embedded Studio, and trying to use the template here as my guide.
https://github.com/sanity-io/sanity-template-nextjs-clean
I’m pretty close, but currently when I hit
http3000/studio , I’m getting a 500 server error that reads “*Error: connect ECONNREFUSED ::1:3333”.* If anyone recognizes this or has a suggestion/question, I’d be much appreciative. I’ll add a couple of my relevant files below, which I hope will help. I should also mention that I have made sure to log in at Sanity.io/manage before hitting the studio url, to rule that out.
AI Update

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:

Things to check:

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.

Show original thread
3 replies

Was this answer helpful?

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.

Related contributions