Skip to content

Conversation

@lobsterkatie
Copy link
Member

In the nextjs SDK, when we wrap users' API routes, we also wrap the response's end method, in order to keep the lambda running the route handler alive long enough to send events to Sentry. As a consequence, however, Next thinks a response hasn't been sent at all, because end hasn't been called within the timeframe that it expects, so it throws a warning in dev.

A previous attempt to fix this problem backfired, and had to be reverted, so as a compromise option for the moment, we log a warning about the Next warning, so at least people know it's nothing to worry about. Some people are finding this behavior spammy, though, so this PR adds an env variable check which allows a user to suppress our meta-warning, and also improves the warning itself so that people know the option is there.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 11, 2022

size-limit report

Path Base Size (ba14cc5) Current Size Change
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.43 KB 20.43 KB +0.01% 🔺
@sentry/browser - ES5 CDN Bundle (minified) 65.2 KB 65.2 KB 0%
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.01 KB 19.01 KB +0.01% 🔺
@sentry/browser - ES6 CDN Bundle (minified) 58.22 KB 58.22 KB 0%
@sentry/browser - Webpack (gzipped + minified) 22.3 KB 22.3 KB 0%
@sentry/browser - Webpack (minified) 76.58 KB 76.58 KB 0%
@sentry/react - Webpack (gzipped + minified) 22.33 KB 22.33 KB 0%
@sentry/nextjs Client - Webpack (gzipped + minified) 46.56 KB 46.56 KB 0%
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 27.25 KB 27.25 KB +0.01% 🔺
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.62 KB 25.62 KB 0%

@Lms24
Copy link
Member

Lms24 commented Mar 11, 2022

Looks good to me (aside from the linter errors obviously).

@lobsterkatie
Copy link
Member Author

Looks good to me (aside from the linter errors obviously).

Damn, I wonder why VSCode didn't catch that. 🤔 Anyway, fixed.

@lobsterkatie lobsterkatie force-pushed the kmclb-nextjs-suppress-no-api-response-warning branch from c0970ac to b974084 Compare March 11, 2022 14:23
@lobsterkatie lobsterkatie enabled auto-merge (squash) March 11, 2022 14:25
@lobsterkatie lobsterkatie merged commit 1124961 into master Mar 11, 2022
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-suppress-no-api-response-warning branch March 11, 2022 14:35
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.

3 participants