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

Page crashes and "Error: Connection closed." appears #49205

Closed
1 task done
hansottowirtz opened this issue May 4, 2023 · 16 comments
Closed
1 task done

Page crashes and "Error: Connection closed." appears #49205

hansottowirtz opened this issue May 4, 2023 · 16 comments
Labels
bug Issue was opened via the bug report template. please add a complete reproduction Please add a complete reproduction.

Comments

@hansottowirtz
Copy link

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 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.15.0
      npm: 9.5.0
      Yarn: 3.5.0
      pnpm: 7.27.0
    Relevant packages:
      next: 13.3.1-canary.4
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

/

To Reproduce

Navigate to a page

Describe the Bug

It's very rare, but we sometimes get "Error: Connection closed." errors that crash the whole page, on navigation to a page. "Application error: a client-side exception has occurred" appears. It seems to happen when traffic to our website is low. Our website is hosted on Vercel and we're using app dir.

Screenshot 2023-05-04 at 14 42 28

It originates from either here:
https://github.com/facebook/react/blob/aef7ce5547c9489dc48e31f69b002cd17206e0cb/packages/react-server/src/ReactFlightReplyServer.js#L579
or here:
https://github.com/facebook/react/blob/aef7ce5547c9489dc48e31f69b002cd17206e0cb/packages/react-server/src/ReactFlightReplyServer.js#L579

Expected Behavior

This shouldn't happen, or at least show the error.tsx error boundary.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Vercel

@hansottowirtz hansottowirtz added the bug Issue was opened via the bug report template. label May 4, 2023
@Dexdot
Copy link

Dexdot commented May 4, 2023

I have the same error. I use [email protected], middleware from next-intl, appDir and next/image + sharp. Deploying on my own ubuntu server with pm2. Same error in console and i see error.tsx boundary

@balazsorban44 balazsorban44 added the please add a complete reproduction Please add a complete reproduction. label May 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 4, 2023

We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate.

Why was this issue marked with the please add a complete reproduction label?

To be able to investigate, we need access to a reproduction to identify what triggered the issue. We prefer a link to a public GitHub repository (template for pages, template for App Router), but you can also use these templates: CodeSandbox: pages or CodeSandbox: App Router.

To make sure the issue is resolved as quickly as possible, please make sure that the reproduction is as minimal as possible. This means that you should remove unnecessary code, files, and dependencies that do not contribute to the issue.

Please test your reproduction against the latest version of Next.js (next@canary) to make sure your issue has not already been fixed.

I added a link, why was it still marked?

Ensure the link is pointing to a codebase that is accessible (e.g. not a private repository). "example.com", "n/a", "will add later", etc. are not acceptable links -- we need to see a public codebase. See the above section for accepted links.

What happens if I don't provide a sufficient minimal reproduction?

Issues with the please add a complete reproduction label that receives no meaningful activity (e.g. new comments with a reproduction link) are automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue with the required reproduction.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment "I have the same issue" without reproduction steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@hansottowirtz
Copy link
Author

hansottowirtz commented May 5, 2023

@balazsorban44 fully understand this is not reproducible, but due to the lack of useful information in the stack trace and the size of our project I can't really make a minimal reproduction. Can we not lock this issue to collect more feedback from other users?

@Dexdot
Copy link

Dexdot commented May 5, 2023

@hansottowirtz try to add export const dynamic = 'force-static'; it helped me

@timneutkens
Copy link
Member

timneutkens commented May 9, 2023

Can we not lock this issue to collect more feedback from other users?

Unfortunately this issue won't be actionable unless a reproduction is provided. If none is provided the issue will be auto-closed. A new issue can be opened with a reproduction if anyone else runs into it.

@phishy
Copy link

phishy commented May 23, 2023

I also get this error, have no idea to boil it down, but am trying.

@phishy
Copy link

phishy commented May 23, 2023

It only happens on Vercel though, and not locally, so it's difficult. I can see that clicking on a link creates a network request, but the page does not render, and if I wait long enough get a "Connection closed" error

@phishy
Copy link

phishy commented May 23, 2023

Actually, it looks like a function is getting stuck rendering, then finally times out after 1 minute. The request id is nowhere to be seen in the logs.

@ivanhueso
Copy link

Hi, I'm gettin the same issue.
It happen once in a while in any page. Lets say I'm 5 minutes clicking and testing each page and at some point I get this error:
Error: Connection closed.

Then i reload and everything is fine again.
This is happening on Vercel as @phishy mentioned, and also in Heroku (what I'm using).
Best

@ijjk
Copy link
Member

ijjk commented May 25, 2023

Hi, this might be related to #50060 which has been updated in v13.4.4-canary.10 of Next.js, please update and give it a try!

@mark-liner
Copy link

Same problem happens in v13.4.4-carnay.10, 11 and also v13.4.5.

@mark-liner
Copy link

For me, it happens on streaming rendering.
It happens more frequently when I try streaming with more than two React Suspense in parallel.

@Ruebs
Copy link

Ruebs commented Jun 1, 2023

Ran into this same issue. Adding the following to any page that was using Suspense fixed it for us:

export const revalidate = 0;

Good luck!

@elliotwestlake
Copy link

Also getting the same issue. @Ruebs's comment didn't seem to help my issue. I have 3 Suspense's rendering on the page. One from loading.tsx and the others manually.

I have tested removing one of the suspenses and that seems to resolve the issue. Only trouble is now that is a blocking call.

@ijjk
Copy link
Member

ijjk commented Jun 9, 2023

Hi, a fix has been landed in react (related PR facebook/react#26871) for this and has now been applied in the latest version of Next.js (related PR #50604)

Please update and give it a try!

@ijjk ijjk closed this as completed Jun 9, 2023
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. please add a complete reproduction Please add a complete reproduction.
Projects
None yet
Development

No branches or pull requests

10 participants