Uh oh!
There was an error while loading. Please reload this page.
fix(nextjs): Let flush finish in API routes - #3811
Conversation
size-limit report
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
kamilogorek
commented
Jul 16, 2021
I went through the broken integration tests. They are all failing because of |
Uh oh!
There was an error while loading. Please reload this page.
lobsterkatie
commented
Jul 16, 2021
Thanks!
Yup, I know that's the underlying problem. But even once I fixed the tests, one is still failing, for mysterious reasons. ¯\(ツ)/¯ I'm sure I'll figure it out. That and the linting stuff I just ran out of time to fix before I turned into a pumpkin last night. |
db7b735 to
d1f1824Compare
rhcarvalho
left a comment
There was a problem hiding this comment.
Had a partial look because @AbhiPrasad asked :)
I'd beg to avoid adding more API surface to general packages.
I understand scope bleed, but that's a much larger topic, I wouldn't try to mix that and the flush fix in one PR.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lobsterkatie
commented
Jul 19, 2021
Recording the results of an IRL convo with @rhcarvalho, @AbhiPrasad, and @kamilogorek. The scope issue is sufficiently complicated (and wide-reaching) that it will be pushed off to another PR. Here, we'll dial it back to just keeping track of the open transaction. |
4657ca7 to
8edb6f6Compare8edb6f6 to
a4763f5CompareAs of getsentry/sentry-javascript#3811, the SDK should now work in API routes.
maccman
commented
Sep 25, 2021
I don't quite understand this - Vercel/Next.js supports return promises. Because of this monkey patching I'm getting: |
As discussed in more detail in the penultimate paragraph of this PR, when deployed to vercel, API route lambdas have been shutting down too soon for sentry events to get reliably sent to our servers (in spite of the use of
flush). This fixes that by wrapping the response's.end()method (which is what triggers the lambda shutdown) such that it waits for flush to finish before emitting itsfinishedsignal.Logs from API routes now consistently look like this:
Fixes#3806
Fixes#3643
Fixes#3691
Fixes#3748
Fixes#3636