diff --git a/packages/nextjs/src/common/captureRequestError.ts b/packages/nextjs/src/common/captureRequestError.ts index 26fdaab4953b..c872d70f8334 100644 --- a/packages/nextjs/src/common/captureRequestError.ts +++ b/packages/nextjs/src/common/captureRequestError.ts @@ -1,5 +1,7 @@ import type { RequestEventData } from '@sentry/core'; +import { vercelWaitUntil } from '@sentry/core'; import { captureException, headersToDict, withScope } from '@sentry/core'; +import { flushSafelyWithTimeout } from './utils/responseEnd'; type RequestInfo = { path: string; @@ -39,5 +41,7 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC handled: false, }, }); + + vercelWaitUntil(flushSafelyWithTimeout()); }); }