-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot set properties of undefined (setting '_sentryTraceData') #14571
Comments
btw I guess it just needs the proper ts cast there.. |
Thanks for writing in! So technically Next.js doesn't allow returning undefined from getInitialProps, so your app will crash regardless. I'll still add a safeguard so that people don't think it is Sentry causing issues. |
@lforst oh well, then it should crash, but it doesn't :/, but yeah, at least not crash on sentry traces so we don't bother you all with these Our robots.txt page work fine without returning something We're adding the |
A PR closing this issue has just been released 🚀This issue was referenced by PR #14575, which was included in the 8.43.0 release. |
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.35.0
Framework Version
Next 14.2.11
Link to Sentry event
https://trusted-health.sentry.io/issues/5833907467/events/651aec0e738f4a8592762072abecec34/
Reproduction Example/SDK Setup
We've been having this issue for a while AFAIK, so here's what we've investigated
From the linked stack trace, these are the lines:
sentry-javascript/packages/nextjs/src/common/pages-router-instrumentation/wrapGetInitialPropsWithSentry.ts
Lines 37 to 48 in 20c267e
If
(await tracedGetInitialProps.apply(thisArg, args))
results inundefined
we get a{}
defaultBut then all these:
become undefined, so we're executing this:
Which will result in those undefined access problems...
You guys also have some other places where there's similar code that might be worth checking
https://github.com/search?q=repo%3Agetsentry%2Fsentry-javascript+tracedGetInitialProps.apply%28thisArg%2C+args%29%29&type=code
It also seems sentry had a similar issue in the past
Steps to Reproduce
Don't know how to simulate
Expected Result
No throw
Actual Result
Throw
The text was updated successfully, but these errors were encountered: