Skip to content

fix(next): Guard against missing serverSideProps #7517

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

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented Mar 20, 2023

I don't know enough about next to be able to tell when this would happen, but as we are type-casting this above it seems prudent enough to check for existence here as well, to be on the safe side.

Fixes #7516

@mydea mydea added the Package: nextjs Issues related to the Sentry Nextjs SDK label Mar 20, 2023
@mydea mydea requested review from lforst and AbhiPrasad March 20, 2023 08:27
@mydea mydea self-assigned this Mar 20, 2023
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.49 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 63.56 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.11 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 56.63 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 21.68 KB (0%)
@sentry/browser - Webpack (minified) 72.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 21.72 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 52.05 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 33.78 KB (0%)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.14 KB (+0.01% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 44.01 KB (+0.03% 🔺)
@sentry/replay - Webpack (gzipped + minified) 38.08 KB (+0.04% 🔺)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 62.24 KB (+0.03% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 55.31 KB (+0.03% 🔺)

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea either when/why this happens but the fix looks good to me. If we find out more about this we might want to adjust the type accordingly. But no need for this to happen now.

@mydea mydea merged commit 8f847ea into develop Mar 20, 2023
@mydea mydea deleted the fn/next-guard-no-props branch March 20, 2023 09:56
@AbhiPrasad
Copy link
Member

As per the type, this seems like a user error (someone writing their getServerSideProps call to return undefined).

@lforst
Copy link
Contributor

lforst commented Mar 20, 2023

As per the type, this seems like a user error (someone writing their getServerSideProps call to return undefined).

My guess too! I think this fix is fine to at least make sure we don't crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use 'in' operator to search for 'props' in undefined
4 participants