Next.js Discord

Discord Forum

Error: Connection closed - on Production deployment

Unanswered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
I'm getting this error:
927-aaed07e464307c3b.js:1 Error: Connection closed.

Only on production deployments, and it happens sometimes when routing between different pages that use React.Suspense to stream. This doesn't happen in local development.

9 Replies

Spectacled CaimanOP
how is this not enough info lol?
that's literally it
European sprat
when does it appear? is it when you access a page or a route? what's the code for the page or the route?
Spectacled CaimanOP
it happens sometimes when routing between different pages that use React.Suspense to stream
the code is too verbose to paste in here, but it is basically just a server component that renders a client component in suspense, something like:

const Comp = () => {
  <Suspense fallback={<Comp3 />}>
    <Comp2 />
  </Suspense>
};

const Comp2 = async () => {
  const data = await getData();
  return <Comp3 data={data} />
}
Comp and Comp2 are server components and Comp3 is a client component
the error shows up sometimes, but if I refresh on the same page that the error showed up on, it goes away
Spectacled CaimanOP
this is a screenshot