Skip to content

Commit e9820bb

Browse files
committed
mark wrapped handlers as wrapped
1 parent 35f560d commit e9820bb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/nextjs/src/utils/withSentry.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ export const withSentry = (origHandler: NextApiHandler): WrappedNextApiHandler =
187187
return boundHandler();
188188
};
189189

190+
// Flag the original handler as already having been wrapped, to prevent it from being wrapped twice (which it could
191+
// be, if someone has already wrapped it manually and then we come along and auto-wrap it)
192+
wrappedHandler.__sentry_wrapped__ = true;
193+
190194
return wrappedHandler;
191195
};
192196

0 commit comments

Comments
 (0)