-
In the if (err) {
Sentry.captureException(err);
// Flushing before returning is necessary if deploying to Vercel, see
// https://vercel.com/docs/platform/limits#streaming-responses
await Sentry.flush(2000);
return errorInitialProps;
} The contents of the given URL are, in its entirety:
This does not explain why Sentry needs to flush if we're deploying to Vercel. So why does it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi, vercel might have updated the docs behind the link in the code so it's not relevant anymore. In essence, we're flushing here because we want all outgoing requests to sentry to be complete before continuing. Why? Vercel uses AWS lambdas behind scenes and those lambdas freeze after sending a response. We don't want the sending of error events to be interrupted by the freeze so we're just blocking the freeze until they're sent - otherwise errors might not get set to sentry. |
Beta Was this translation helpful? Give feedback.
-
There is an open issue now. I suggest we follow the conversation in #5131 |
Beta Was this translation helpful? Give feedback.
Hi, vercel might have updated the docs behind the link in the code so it's not relevant anymore.
In essence, we're flushing here because we want all outgoing requests to sentry to be complete before continuing. Why? Vercel uses AWS lambdas behind scenes and those lambdas freeze after sending a response. We don't want the sending of error events to be interrupted by the freeze so we're just blocking the freeze until they're sent - otherwise errors might not get set to sentry.