facebook / react

The library for web and native user interfaces.
https://react.dev
MIT License
229.29k stars 46.96k forks source link

Bug: Suspense Exception in react-server-dom-webpack #27896

Closed Lewin-R closed 10 months ago

Lewin-R commented 10 months ago

I just began using Sentry in the Next project I'm currently working on and found relatively quickly that a very weird error is being thrown in production at: (react-server)/./dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js at line 12:123419

The error in Sentry states the following: Suspense Exception: This is not a real error! It's an implementation detail of use to interrupt the current render. You must either rethrow it immediately, or move the use call outside of the try/catch block. Capturing without rethrowing will l...

Hosting this project on Vercel.

React version: 18.2.0 Node version: 20.9.0

The current behavior

An error is being thrown even though it states it is not a real error.

The expected behavior

The error should not be thrown if it is not a real error.

rickhanlonii commented 10 months ago

This is probably happening because the you have use being caught in a try/catch, so the error message is accurate (see this PR for more info https://github.com/facebook/react/pull/25543).

If that's not the case, please share a codesandbox to show how it's happening and I can re-open and take a look.

markomitranic commented 8 months ago

I wonder if you have some advice on figuring out what causes it? Judging by the comment on #25543 and also my personal experience, if this error happens in a vendor module, it won't be visible in dev, only if it happens in user space.

This, for example, means that I end up having this error in production and preview Sentry, but can never replicate it locally.

octavian-participayed commented 5 months ago

I'm also encountering this issue. Anyone out there who managed to solve this problem? I'm not even using the use hook anywhere in the app, so it's pretty weird that this error is being thrown.