diff --git a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts b/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts index 601105bab7be..0ebe0ba79d13 100644 --- a/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts +++ b/packages/nextjs/src/common/wrapGetInitialPropsWithSentry.ts @@ -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) {