fix(nextjs): Add env var to suppress API non-response meta-warning#4706
Merged
lobsterkatie merged 1 commit intomasterfrom Mar 11, 2022
Merged
Conversation
5 tasks
Contributor
size-limit report
|
Lms24
approved these changes
Mar 11, 2022
Member
|
Looks good to me (aside from the linter errors obviously). |
Member
Author
Damn, I wonder why VSCode didn't catch that. 🤔 Anyway, fixed. |
c0970ac to
b974084
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the nextjs SDK, when we wrap users' API routes, we also wrap the response's
endmethod, 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, becauseendhasn'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.