Skip to content

Commit c2a12dd

Browse files
committed
fix(astro): waitUntil flush at end of request
1 parent 4f05f12 commit c2a12dd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/astro/src/server/middleware.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import {
1414
import type { Scope, SpanAttributes } from '@sentry/types';
1515
import {
1616
addNonEnumerableProperty,
17+
flushSafelyWithTimeout,
1718
objectify,
1819
stripUrlQueryAndFragment,
20+
vercelWaitUntil,
1921
winterCGRequestToRequestData,
2022
} from '@sentry/utils';
2123
import type { APIContext, MiddlewareResponseHandler } from 'astro';
@@ -188,6 +190,8 @@ async function instrumentRequest(
188190
} catch (e) {
189191
sendErrorToSentry(e);
190192
throw e;
193+
} finally {
194+
vercelWaitUntil(flushSafelyWithTimeout());
191195
}
192196
// TODO: flush if serverless (first extract function)
193197
},

0 commit comments

Comments
 (0)