Files
klz-cables.com/.pnpm-store/v10/files/0b/35695a1a860478ad55b6fba0277276fbd79d9af17ba2372a3fb67e9a86871d91d19f15d2846fb03f94ce87d89e04cedcdf31333a643e7a3e6c53c9db26c465
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

68 lines
2.5 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const isBuild = require('../utils/isBuild.js');
const wrapperUtils = require('../utils/wrapperUtils.js');
/**
* Create a wrapped version of the user's exported `getInitialProps` function in
* a custom error page ("_error.js").
*
* @param origErrorGetInitialProps The user's `getInitialProps` function
* @param parameterizedRoute The page's parameterized route
* @returns A wrapped version of the function
*/
function wrapErrorGetInitialPropsWithSentry(
origErrorGetInitialProps,
) {
return new Proxy(origErrorGetInitialProps, {
apply: async (wrappingTarget, thisArg, args) => {
if (isBuild.isBuild()) {
return wrappingTarget.apply(thisArg, args);
}
const [context] = args;
const { req, res } = context;
const errorWrappedGetInitialProps = wrapperUtils.withErrorInstrumentation(wrappingTarget);
// Generally we can assume that `req` and `res` are always defined on the server:
// https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object
// This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher
// span with each other when there are no req or res objects, we simply do not trace them at all here.
if (req && res) {
const tracedGetInitialProps = wrapperUtils.withTracedServerSideDataFetcher(errorWrappedGetInitialProps, req, res, {
dataFetcherRouteName: '/_error',
requestedRouteName: context.pathname,
dataFetchingMethodName: 'getInitialProps',
});
const {
data: errorGetInitialProps,
baggage,
sentryTrace,
}
= await tracedGetInitialProps.apply(thisArg, args);
if (typeof errorGetInitialProps === 'object' && errorGetInitialProps !== null) {
if (sentryTrace) {
// The Next.js serializer throws on undefined values so we need to guard for it (#12102)
(errorGetInitialProps )._sentryTraceData = sentryTrace;
}
// The Next.js serializer throws on undefined values so we need to guard for it (#12102)
if (baggage) {
(errorGetInitialProps )._sentryBaggage = baggage;
}
}
return errorGetInitialProps;
} else {
return errorWrappedGetInitialProps.apply(thisArg, args);
}
},
});
}
exports.wrapErrorGetInitialPropsWithSentry = wrapErrorGetInitialPropsWithSentry;
//# sourceMappingURL=wrapErrorGetInitialPropsWithSentry.js.map