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

(Nextjs) - Sentry - React three fiber bug #13413

Closed
3 tasks done
chrisweb opened this issue Aug 17, 2024 · 4 comments
Closed
3 tasks done

(Nextjs) - Sentry - React three fiber bug #13413

chrisweb opened this issue Aug 17, 2024 · 4 comments

Comments

@chrisweb
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.26.0

Framework Version

Next 14.2.5

Link to Sentry event

https://chrisweb.sentry.io/issues/5724309981/?project=4507792998465536&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=24h&stream_index=0

Reproduction Example/SDK Setup

https://github.com/chrisweb/bug_repodruction_undefined-_reading_sentry

!!! error happens only in "production" (don't use npm run dev):

npm run build
npm run start

Steps to Reproduce

start nextjs in production (npm run build, then npm run start)
open browser, localhost:3000
page will try to load a react three fiber canvas
error gets triggered

Expected Result

No error in browser console

Actual Result

Error in browser console:
TypeError: Cannot read properties of undefined (reading 'sentry')
at 79-69aeb92584b14fbc.js:1:5614
at Array.reduce ()
at G (79-69aeb92584b14fbc.js:1:5599)
(...)

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Aug 17, 2024
@chrisweb
Copy link
Author

chrisweb commented Aug 17, 2024

I tried to find the "real" reason for the problem, but I couldn't find it (yet)

Also, I'm sorry if this is not a Sentry but a https://github.com/pmndrs/react-three-fiber bug, I was not sure this belongs in here

I posted it as a Sentry bug, because even though the error seems to get thrown in Fiber https://github.com/pmndrs/react-three-fiber/blob/a457290856f57741bf8beef4f6ff9dbf4879c0a5/packages/fiber/src/core/utils.ts#L337, I have the feeling that Fiber has a problem because maybe Sentry has added some Sentry specific attributes to the canvas element, actually there is an ambientlight three fiber component (inside of the canvas) where sentry seems to have added attributes and this seems to be the initial cause

Image

When I remove Sentry from the Next.js configuration then everything is OK (no error in the console)

Also this error is only happens, when Next.js runs in "production", in development there is NO error

I tried to disable sentry integrations like breadcrumbs dom and also disable replaycanvas but the sentry attributes kept being placed onto fiber components as well as the canvas element itself

@chrisweb
Copy link
Author

chrisweb commented Aug 17, 2024

I found another Issue afterall, which seems to be about the problem I describe: getsentry/sentry-javascript-bundler-plugins#530

EDIT: so yes, that Issue sentry-javascript-bundler-plugins #530 is about the same problem, disabling reactComponentAnnotation fixes the react three fiber problem

next.config.js:

export default withSentryConfig(nextConfig, {

    // Automatically annotate React components to show their full name in breadcrumbs and session replay
    reactComponentAnnotation: {
        enabled: false,
    },

});

As suggested in the sentry-javascript-bundler-plugins #530 Issue, a way to exclude some components would be really useful

@Lms24
Copy link
Member

Lms24 commented Aug 19, 2024

Hey @chrisweb thanks for writing in!

We'll look into your issue next week as this week is Hackweek at Sentry (see #13421).

@Lms24 Lms24 added Post Hackweek and removed Package: nextjs Issues related to the Sentry Nextjs SDK labels Aug 19, 2024
@lforst
Copy link
Member

lforst commented Aug 26, 2024

Hi, thanks for being patient! Since we have established that this is caused by getsentry/sentry-javascript-bundler-plugins#530 I'll close this issue and we'll track it over there. cc @0Calories

@lforst lforst closed this as completed Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants