Skip to content

Commit aaae4ab

Browse files
committed
fix astro
1 parent 12809b3 commit aaae4ab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/astro/src/server/middleware.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,12 @@ async function instrumentRequest(
8888
): Promise<Response> {
8989
// Make sure we don't accidentally double wrap (e.g. user added middleware and integration auto added it)
9090
const locals = ctx.locals as AstroLocalsWithSentry | undefined;
91-
if (!locals || locals.__sentry_wrapped__) {
91+
if (locals?.__sentry_wrapped__) {
9292
return next();
9393
}
94-
addNonEnumerableProperty(locals, '__sentry_wrapped__', true);
94+
if (locals) {
95+
addNonEnumerableProperty(locals, '__sentry_wrapped__', true);
96+
}
9597

9698
const isDynamicPageRequest = checkIsDynamicPageRequest(ctx);
9799

0 commit comments

Comments
 (0)