Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Connection Closed on Redirect #58515

Open
1 task done
brizzbuzz opened this issue Nov 16, 2023 · 2 comments
Open
1 task done

Error Connection Closed on Redirect #58515

brizzbuzz opened this issue Nov 16, 2023 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@brizzbuzz
Copy link

Link to the code that reproduces this issue

https://github.com/unredundant/nextjs-crash-on-redirect

To Reproduce

  1. Start the server in dev mode
  2. Go to port 3000 (or, whichever port the web app binds to)
  3. Enter the form info (any placeholder email and password will do)
  4. Feast you eyes on the glorious crash
  5. a reload with cmd r will load the dashboard page as expected, showing the page actually exists.

Confirmed on both pop_os 22.04 and macos whatever they called it (latest)

Current vs. Expected behavior

I should be able to redirect my web app to another page.

CleanShot 2023-11-15 at 18 54 07

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000
Binaries:
  Node: 20.5.1
  npm: 9.8.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 13.5.6
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

web:dev:  ⨯ Error: Connection closed.
web:dev:     at tu (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/next-se
rver/app-page.runtime.dev.js:35:303532)
web:dev:     at t.decodeReply (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compi
led/next-server/app-page.runtime.dev.js:35:304915)
web:dev:     at /Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/next-server
/app-page.runtime.dev.js:38:264
web:dev:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
web:dev:     at async tX (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/n
ext-server/app-page.runtime.dev.js:37:5207)
web:dev:     at async rl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/compiled/n
ext-server/app-page.runtime.dev.js:38:22994)
web:dev:     at async doRender (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next/dist/serv
er/base-server.js:1407:30)
web:dev:     at async cacheEntry.responseCache.get.routeKind (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/w
eb/node_modules/next/dist/server/base-server.js:1571:28)
web:dev:     at async DevServer.renderToResponseWithComponentsImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/
apps/web/node_modules/next/dist/server/base-server.js:1479:28)
web:dev:     at async DevServer.renderPageComponent (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_m
odules/next/dist/server/base-server.js:1850:24)
web:dev:     at async DevServer.renderToResponseImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_
modules/next/dist/server/base-server.js:1888:32)
web:dev:     at async DevServer.pipeImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_modules/next
/dist/server/base-server.js:902:25)
web:dev:     at async NextNodeServer.handleCatchallRenderRequest (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/ap
ps/web/node_modules/next/dist/server/next-server.js:266:17)
web:dev:     at async DevServer.handleRequestImpl (/Users/megame/Workspace/unredundant/nextjs-crash-on-redirect/apps/web/node_mod
ules/next/dist/server/base-server.js:798:17) {
web:dev:   page: '/dashboard'
web:dev: }
@brizzbuzz brizzbuzz added the bug Issue was opened via the bug report template. label Nov 16, 2023
@HarrisonPortwood
Copy link

HarrisonPortwood commented Nov 25, 2023

@unredundant

A workaround to this would be:
return Response.redirect(${request.nextUrl.origin}/dashboard);

Check out this comment made by another user for more info

@MihinMUD
Copy link

MihinMUD commented Jun 3, 2024

The workaround doesn't work for me because I'm on a server action. The error doesn't appear on dev but only on production build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants