Skip to content

Commit

Permalink
fix(nextjs): Guard for case where getInitialProps may return undefi…
Browse files Browse the repository at this point in the history
…ned (#9342)
  • Loading branch information
lforst authored Oct 24, 2023
1 parent a0ff516 commit 7c84181
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function wrapGetInitialPropsWithSentry(origGetInitialProps: GetInitialPro
const initialProps: {
_sentryTraceData?: string;
_sentryBaggage?: string;
} = await tracedGetInitialProps.apply(thisArg, args);
} = (await tracedGetInitialProps.apply(thisArg, args)) ?? {}; // Next.js allows undefined to be returned from a getInitialPropsFunction.

const requestTransaction = getTransactionFromRequest(req) ?? hub.getScope().getTransaction();
if (requestTransaction) {
Expand Down

0 comments on commit 7c84181

Please sign in to comment.