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

fix(nextjs): Fix broken server component wrapping because of interrupted promise chain #7456

Merged
merged 2 commits into from Mar 14, 2023

Conversation

lforst
Copy link
Member

@lforst lforst commented Mar 14, 2023

Our canary tests for Next.js started failing #7452 - in particular Next.js version 13.2.4.

This was/is an actual bug that is fixed by that PR. Apparently, from that version onwards, Next.js attaches additional values to the promises returned from server components, and the way we wrapped server components we janked those values off the returned promise causing Next.js to crash.

@lforst lforst requested review from mydea and AbhiPrasad March 14, 2023 10:12

// It is very important that we return the original promise here, because Next.js attaches various properties
// to that promise and will throw if they are not on the returned value.
return maybePromiseResult;
Copy link
Member

Choose a reason for hiding this comment

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

omg I actually can't believe they are doing this.

who attaches stuff to the promise directly????

Copy link
Member

Choose a reason for hiding this comment

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

🥲

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

This feels like an anti-pattern.

Glad the tests caught this though!

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.4 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 63.27 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.97 KB (-0.01% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 56.18 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.64 KB (0%)
@sentry/browser - Webpack (minified) 67.41 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.66 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.66 KB (+0.23% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.74 KB (+0.37% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26 KB (+0.37% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.17 KB (0%)
@sentry/replay - Webpack (gzipped + minified) 37.19 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 61.29 KB (+0.16% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 54.37 KB (0%)

@lforst
Copy link
Member Author

lforst commented Mar 14, 2023

This feels like an anti-pattern.

I agree. Something feels off here. I don't know what. Maybe this will cause issues at some point. I also think flushing will be kinda messed up with this but I wanna worry about that later.

@lforst lforst merged commit 45f5c21 into develop Mar 14, 2023
31 checks passed
@lforst lforst deleted the lforst-fix-broken-nextjs-server-components branch March 14, 2023 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants