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
1 line
3.1 KiB
Plaintext
1 line
3.1 KiB
Plaintext
{"version":3,"file":"wrapDocumentGetInitialPropsWithSentry.js","sources":["../../../../src/common/pages-router-instrumentation/wrapDocumentGetInitialPropsWithSentry.ts"],"sourcesContent":["import type Document from 'next/document';\nimport { isBuild } from '../utils/isBuild';\nimport { withErrorInstrumentation, withTracedServerSideDataFetcher } from '../utils/wrapperUtils';\n\ntype DocumentGetInitialProps = typeof Document.getInitialProps;\n\n/**\n * Create a wrapped version of the user's exported `getInitialProps` function in\n * a custom document (\"_document.js\").\n *\n * @param origDocumentGetInitialProps The user's `getInitialProps` function\n * @param parameterizedRoute The page's parameterized route\n * @returns A wrapped version of the function\n */\nexport function wrapDocumentGetInitialPropsWithSentry(\n origDocumentGetInitialProps: DocumentGetInitialProps,\n): DocumentGetInitialProps {\n return new Proxy(origDocumentGetInitialProps, {\n apply: async (wrappingTarget, thisArg, args: Parameters<DocumentGetInitialProps>) => {\n if (isBuild()) {\n return wrappingTarget.apply(thisArg, args);\n }\n\n const [context] = args;\n const { req, res } = context;\n\n const errorWrappedGetInitialProps = withErrorInstrumentation(wrappingTarget);\n // Generally we can assume that `req` and `res` are always defined on the server:\n // https://nextjs.org/docs/api-reference/data-fetching/get-initial-props#context-object\n // This does not seem to be the case in dev mode. Because we have no clean way of associating the the data fetcher\n // span with each other when there are no req or res objects, we simply do not trace them at all here.\n if (req && res) {\n const tracedGetInitialProps = withTracedServerSideDataFetcher(errorWrappedGetInitialProps, req, res, {\n dataFetcherRouteName: '/_document',\n requestedRouteName: context.pathname,\n dataFetchingMethodName: 'getInitialProps',\n });\n\n const { data } = await tracedGetInitialProps.apply(thisArg, args);\n return data;\n } else {\n return errorWrappedGetInitialProps.apply(thisArg, args);\n }\n },\n });\n}\n"],"names":[],"mappings":";;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,qCAAqC;AACrD,EAAE,2BAA2B;AAC7B,EAA2B;AAC3B,EAAE,OAAO,IAAI,KAAK,CAAC,2BAA2B,EAAE;AAChD,IAAI,KAAK,EAAE,OAAO,cAAc,EAAE,OAAO,EAAE,IAAI,KAA0C;AACzF,MAAM,IAAI,OAAO,EAAE,EAAE;AACrB,QAAQ,OAAO,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;AAClD,MAAM;;AAEN,MAAM,MAAM,CAAC,OAAO,CAAA,GAAI,IAAI;AAC5B,MAAM,MAAM,EAAE,GAAG,EAAE,GAAA,EAAI,GAAI,OAAO;;AAElC,MAAM,MAAM,2BAAA,GAA8B,wBAAwB,CAAC,cAAc,CAAC;AAClF;AACA;AACA;AACA;AACA,MAAM,IAAI,GAAA,IAAO,GAAG,EAAE;AACtB,QAAQ,MAAM,qBAAA,GAAwB,+BAA+B,CAAC,2BAA2B,EAAE,GAAG,EAAE,GAAG,EAAE;AAC7G,UAAU,oBAAoB,EAAE,YAAY;AAC5C,UAAU,kBAAkB,EAAE,OAAO,CAAC,QAAQ;AAC9C,UAAU,sBAAsB,EAAE,iBAAiB;AACnD,SAAS,CAAC;;AAEV,QAAQ,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,qBAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;AACzE,QAAQ,OAAO,IAAI;AACnB,MAAM,OAAO;AACb,QAAQ,OAAO,2BAA2B,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;AAC/D,MAAM;AACN,IAAI,CAAC;AACL,GAAG,CAAC;AACJ;;;;"} |