You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flushing with timeout doesn't timeout and eventually crashes #3806
Provide a link to the affected event from your Sentry account
Package + Version
@sentry/nextjs 6.9.0
Description
Using this code in a Next.js API:
import{captureException,flush,withSentry}from'@sentry/nextjs';consthandler=async()=>{try{thrownewError('This is a fake error meant to help testing Sentry error reporting (monitoring).');}catch(e){captureException(e);awaitflush(5000);// Need to flush on API to send errors properly (issue in @sentry/nextjs)}};exportdefaultwithSentry(handler);
Calling the API endpoint runs until the Serverless function times out.
Providing a value to flush() doesn't seem to be effective.
Activity
Vadorequest commentedon Jul 14, 2021
Also note I had to manually flush because if I don't, no error gets logged...
Vadorequest commentedon Jul 14, 2021
I had forgotten to run
res.end()at the end, that was the cause of the infinite loading.But, the events don't show in Sentry nevertheless.
kamilogorek commentedon Jul 15, 2021
@lobsterkatie this is 99% the issue that you already found here -
sentry-javascript/packages/nextjs/src/utils/handlers.ts
Lines 113 to 153 in ecfc3c7
lobsterkatie commentedon Jul 19, 2021
Yup - that's exactly it. There are still a few things in flux with that PR, but it should merge this week.