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): Unwrap req and res if necessary when instrumenting server #4467

Merged
merged 5 commits into from Jan 28, 2022

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Jan 28, 2022

h/t to @YukiKitagata for finding the relevant change to Next.js and providing an initial implementation of this fix.


In vercel/next.js#32999 (released as part of 12.0.9), Next.js made an internal change, so that it now wraps the raw http.IncomingMessage and http.ServerResponse objects which get passed to the main server request handler in NodeNextRequest and NodeNextResponse objects, respectively. We therefore need to unwrap them before we can use them.

This does that unwrapping (if necessary; older versions of nextjs still don't need it) and fixes the relevant types.

Fixes #4463
Fixes vercel/next.js#33726

@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2022

size-limit report

Path Base Size (8cbcff2) Current Size Change
@sentry/browser - CDN Bundle (gzipped) 19.68 KB 19.69 KB +0.01% 🔺
@sentry/browser - CDN Bundle (minified) 62.85 KB 62.86 KB +0.01% 🔺
@sentry/browser - Webpack 22.2 KB 22.2 KB 0%
@sentry/browser - Webpack - gzip = false 75.99 KB 75.99 KB 0%
@sentry/react - Webpack 22.24 KB 22.24 KB 0%
@sentry/nextjs Client - Webpack 46.22 KB 46.22 KB 0%
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.21 KB 28.22 KB +0.01% 🔺

@hckhanh
Copy link

hckhanh commented Jan 28, 2022

Hi @lobsterkatie, Is there anything I can help with this PR?

@bonesoul
Copy link

hi there, when should we expect this land?

@AbhiPrasad
Copy link
Member

Hey folks, we'll be cutting a patch release right after this gets merged in! Release should be out by end of day today!

@lobsterkatie lobsterkatie merged commit f794dbd into master Jan 28, 2022
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-unwrap-req-and-res branch January 28, 2022 15:17
@AbhiPrasad
Copy link
Member

AbhiPrasad commented Jan 28, 2022

For those watching this PR - getsentry/publish#775 will track the state of the release. When that issue is closed, the release should be out under @sentry/nextjs@6.17.3

Edit: Released with https://www.npmjs.com/package/@sentry/nextjs/v/6.17.3

BitOfUniverse added a commit to BitOfUniverse/pancake-frontend that referenced this pull request Feb 3, 2022
Recent update of Nextjs broke integration with Sentry and requires update for Sentry package.
vercel/next.js#33726
Issue was fixed here: getsentry/sentry-javascript#4467
BitOfUniverse added a commit to BitOfUniverse/pancake-frontend that referenced this pull request Feb 3, 2022
Recent update of Nextjs broke integration with Sentry and requires update for Sentry package.
vercel/next.js#33726
Issue was fixed here: getsentry/sentry-javascript#4467
BitOfUniverse added a commit to BitOfUniverse/pancake-frontend that referenced this pull request Feb 3, 2022
Recent update of Nextjs broke integration with Sentry and requires update for Sentry package.
vercel/next.js#33726
Issue was fixed here: getsentry/sentry-javascript#4467
BitOfUniverse added a commit to BitOfUniverse/pancake-frontend that referenced this pull request Feb 3, 2022
Recent update of Nextjs broke integration with Sentry and requires update for Sentry package.
vercel/next.js#33726
Issue was fixed here: getsentry/sentry-javascript#4467
chef-jojo pushed a commit to pancakeswap/pancake-frontend that referenced this pull request Feb 3, 2022
Recent update of Nextjs broke integration with Sentry and requires update for Sentry package.
vercel/next.js#33726
Issue was fixed here: getsentry/sentry-javascript#4467
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.

res.once is not a function uncaughtException: TypeError: res.once is not a function
5 participants