Skip to content

Commit d9ca31b

Browse files
committed
fix(nextjs): Don't write to res.end to fix next export
1 parent 7408b0a commit d9ca31b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/nextjs/src/config/wrappers/utils/responseEnd.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ export function autoEndTransactionOnResponseEnd(transaction: Transaction, res: S
3131
};
3232

3333
// Prevent double-wrapping
34-
if (!(res.end as WrappedResponseEndMethod).__sentry_original__) {
34+
// res.end may be undefined during build when using `next export` to statically export a Next.js app
35+
if (res.end && !(res.end as WrappedResponseEndMethod).__sentry_original__) {
3536
fill(res, 'end', wrapEndMethod);
3637
}
3738
}

0 commit comments

Comments
 (0)