Files
klz-cables.com/.pnpm-store/v10/files/7a/30a7373fdb6d2166408e40df52558e1f45c29967ad62058017b6526a21ad437321673d6f0eb9e74255b6b1aba3e7e5f42b0d5ff1c1583a445807cf9133a649
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

58 lines
1.9 KiB
Plaintext

import { isBuild } from '../utils/isBuild.js';
import { withTracedServerSideDataFetcher, withErrorInstrumentation } from '../utils/wrapperUtils.js';
/**
* Create a wrapped version of the user's exported `getServerSideProps` function
*
* @param origGetServerSideProps The user's `getServerSideProps` function
* @param parameterizedRoute The page's parameterized route
* @returns A wrapped version of the function
*/
function wrapGetServerSidePropsWithSentry(
origGetServerSideProps,
parameterizedRoute,
) {
return new Proxy(origGetServerSideProps, {
apply: async (wrappingTarget, thisArg, args) => {
if (isBuild()) {
return wrappingTarget.apply(thisArg, args);
}
const [context] = args;
const { req, res } = context;
const errorWrappedGetServerSideProps = withErrorInstrumentation(wrappingTarget);
const tracedGetServerSideProps = withTracedServerSideDataFetcher(errorWrappedGetServerSideProps, req, res, {
dataFetcherRouteName: parameterizedRoute,
requestedRouteName: parameterizedRoute,
dataFetchingMethodName: 'getServerSideProps',
});
const {
data: serverSideProps,
baggage,
sentryTrace,
}
= await (tracedGetServerSideProps.apply(thisArg, args) );
if (typeof serverSideProps === 'object' && serverSideProps !== null && 'props' in serverSideProps) {
// The Next.js serializer throws on undefined values so we need to guard for it (#12102)
if (sentryTrace) {
(serverSideProps.props )._sentryTraceData = sentryTrace;
}
// The Next.js serializer throws on undefined values so we need to guard for it (#12102)
if (baggage) {
(serverSideProps.props )._sentryBaggage = baggage;
}
}
return serverSideProps;
},
});
}
export { wrapGetServerSidePropsWithSentry };
//# sourceMappingURL=wrapGetServerSidePropsWithSentry.js.map