From c9a288033f41be4bd09e8cc80cccdbe8dca116fa Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Fri, 31 Mar 2023 09:44:02 -0700 Subject: [PATCH 1/7] chore(deps): upgrade sentry to 7.46.0 --- frontend/package.json | 4 +- packages/sentry/package.json | 2 +- pnpm-lock.yaml | 142 ++++++++++++++++++----------------- 3 files changed, 77 insertions(+), 71 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index af0c33f7..1183a232 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -46,8 +46,8 @@ "@ifixit/shopify-storefront-client": "workspace:*", "@ifixit/ui": "workspace:*", "@ifixit/menu": "workspace:*", - "@sentry/nextjs": "7.42.0", - "@sentry/tracing": "7.42.0", + "@sentry/nextjs": "7.46.0", + "@sentry/tracing": "7.46.0", "@tanstack/react-query": "4.14.5", "algoliasearch": "4.13.1", "cookie": "0.5.0", diff --git a/packages/sentry/package.json b/packages/sentry/package.json index 260b89a3..8017476c 100644 --- a/packages/sentry/package.json +++ b/packages/sentry/package.json @@ -6,7 +6,7 @@ "license": "MIT", "dependencies": { "@ifixit/helpers": "workspace:*", - "@sentry/nextjs": "^7.42.0" + "@sentry/nextjs": "7.46.0" }, "peerDependencies": { "next": "12.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f2a76dca..014c809a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,8 +58,8 @@ importers: '@ifixit/ui': workspace:* '@next/bundle-analyzer': 12.1.6 '@playwright/test': 1.29.1 - '@sentry/nextjs': 7.42.0 - '@sentry/tracing': 7.42.0 + '@sentry/nextjs': 7.46.0 + '@sentry/tracing': 7.46.0 '@svgr/webpack': 6.5.1 '@tanstack/react-query': 4.14.5 '@testing-library/dom': 8.19.0 @@ -145,8 +145,8 @@ importers: '@ifixit/sentry': link:../packages/sentry '@ifixit/shopify-storefront-client': link:../packages/shopify-storefront-client '@ifixit/ui': link:../packages/ui - '@sentry/nextjs': 7.42.0_5cy3dema5qwip6n7exqk4sqtji - '@sentry/tracing': 7.42.0 + '@sentry/nextjs': 7.46.0_5cy3dema5qwip6n7exqk4sqtji + '@sentry/tracing': 7.46.0 '@tanstack/react-query': 4.14.5_biqbaboplfbrettd7655fr4n2y algoliasearch: 4.13.1 cookie: 0.5.0 @@ -473,14 +473,14 @@ importers: '@babel/core': '>=7.0.0 <8.0.0' '@ifixit/helpers': workspace:* '@ifixit/tsconfig': workspace:* - '@sentry/nextjs': ^7.42.0 + '@sentry/nextjs': 7.46.0 next: ^10.0.8 || ^11.0 || ^12.0 react: '>=18.2.0' react-dom: '>=18.2.0' typescript: 4.8.4 dependencies: '@ifixit/helpers': link:../helpers - '@sentry/nextjs': 7.42.0_next@12.2.3+react@18.2.0 + '@sentry/nextjs': 7.46.0_next@12.2.3+react@18.2.0 devDependencies: '@babel/core': 7.18.6 '@ifixit/tsconfig': link:../tsconfig @@ -6392,7 +6392,7 @@ packages: detect-libc: 2.0.1 https-proxy-agent: 5.0.1 make-dir: 3.1.0 - node-fetch: 2.6.7 + node-fetch: 2.6.9 nopt: 5.0.0 npmlog: 5.0.1 rimraf: 3.0.2 @@ -6813,14 +6813,25 @@ packages: - zenObservable dev: true - /@sentry/browser/7.42.0: - resolution: {integrity: sha512-xTwfvrQPmYTkAvGivoJFadPLKLDS2N57D/18NA1gcrnF8NwR+I28x3I9ziVUiMCYX+6nJuqBNlMALAEPbb2G5A==} + /@sentry-internal/tracing/7.46.0: + resolution: {integrity: sha512-KYoppa7PPL8Er7bdPoxTNUfIY804JL7hhOEomQHYD22rLynwQ4AaLm3YEY75QWwcGb0B7ZDMV+tSumW7Rxuwuw==} + engines: {node: '>=8'} + dependencies: + '@sentry/core': 7.46.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 + tslib: 1.14.1 + dev: false + + /@sentry/browser/7.46.0: + resolution: {integrity: sha512-4rX9hKPjxzfH5LhZzO5DlS5NXQ8qZg2ibepaqEgcDHrpYh5813mjjnE4OQA8wiZ6WuG3xKFgHBrGeliD5jXz9w==} engines: {node: '>=8'} dependencies: - '@sentry/core': 7.42.0 - '@sentry/replay': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry-internal/tracing': 7.46.0 + '@sentry/core': 7.46.0 + '@sentry/replay': 7.46.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 tslib: 1.14.1 dev: false @@ -6841,27 +6852,27 @@ packages: - supports-color dev: false - /@sentry/core/7.42.0: - resolution: {integrity: sha512-vNcTyoQz5kUXo5vMGDyc5BJMO0UugPvMfYMQVxqt/BuDNR30LVhY+DL2tW1DFZDvRvyn5At+H7kSTj6GFrANXQ==} + /@sentry/core/7.46.0: + resolution: {integrity: sha512-BnNHGh/ZTztqQedFko7vb2u6yLs/kWesOQNivav32ZbsEpVCjcmG1gOJXh2YmGIvj3jXOC9a4xfIuh+lYFcA6A==} engines: {node: '>=8'} dependencies: - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 tslib: 1.14.1 dev: false - /@sentry/integrations/7.42.0: - resolution: {integrity: sha512-5P3LsU+HRmdh458mav3dNh8RCn0TROIxwa/b7jk1TLWcXHrNp5REjo1oI4PTC+fFbNE4b7ydwHNEzI65rz7gyA==} + /@sentry/integrations/7.46.0: + resolution: {integrity: sha512-Y/KreRcROYJif0nM8+kQAkaCvuwGzpqMwLKkC5CfG1xLLDch+OI7HRU98HevyqXNk6YAzQdvBOYXSe7Ny6Zc0A==} engines: {node: '>=8'} dependencies: - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 localforage: 1.10.0 tslib: 1.14.1 dev: false - /@sentry/nextjs/7.42.0_5cy3dema5qwip6n7exqk4sqtji: - resolution: {integrity: sha512-UM3yEnnPyoFxYNynARZR9aBROvVG+nIHn6aE1uBtrKONUDren/gHlED/qqum3TDL5yc38Jwx5ZZ+gUYQZENfJA==} + /@sentry/nextjs/7.46.0_5cy3dema5qwip6n7exqk4sqtji: + resolution: {integrity: sha512-v6Eigug95d2BUkFNPSLJ3L5PX2SEObcR14H0B9KSoX8nbocIEpIN6joQ+V0YPv9NR35kI83RUBZI36V3RsMl4A==} engines: {node: '>=8'} peerDependencies: next: ^10.0.8 || ^11.0 || ^12.0 || ^13.0 @@ -6872,13 +6883,12 @@ packages: optional: true dependencies: '@rollup/plugin-commonjs': 24.0.0_rollup@2.78.0 - '@sentry/core': 7.42.0 - '@sentry/integrations': 7.42.0 - '@sentry/node': 7.42.0 - '@sentry/react': 7.42.0_react@18.2.0 - '@sentry/tracing': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/core': 7.46.0 + '@sentry/integrations': 7.46.0 + '@sentry/node': 7.46.0 + '@sentry/react': 7.46.0_react@18.2.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 '@sentry/webpack-plugin': 1.20.0 chalk: 3.0.0 next: 12.2.3_t7ss3ubh4wigfvyfclbvqff3gm @@ -6892,8 +6902,8 @@ packages: - supports-color dev: false - /@sentry/nextjs/7.42.0_next@12.2.3+react@18.2.0: - resolution: {integrity: sha512-UM3yEnnPyoFxYNynARZR9aBROvVG+nIHn6aE1uBtrKONUDren/gHlED/qqum3TDL5yc38Jwx5ZZ+gUYQZENfJA==} + /@sentry/nextjs/7.46.0_next@12.2.3+react@18.2.0: + resolution: {integrity: sha512-v6Eigug95d2BUkFNPSLJ3L5PX2SEObcR14H0B9KSoX8nbocIEpIN6joQ+V0YPv9NR35kI83RUBZI36V3RsMl4A==} engines: {node: '>=8'} peerDependencies: next: ^10.0.8 || ^11.0 || ^12.0 || ^13.0 @@ -6904,13 +6914,12 @@ packages: optional: true dependencies: '@rollup/plugin-commonjs': 24.0.0_rollup@2.78.0 - '@sentry/core': 7.42.0 - '@sentry/integrations': 7.42.0 - '@sentry/node': 7.42.0 - '@sentry/react': 7.42.0_react@18.2.0 - '@sentry/tracing': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/core': 7.46.0 + '@sentry/integrations': 7.46.0 + '@sentry/node': 7.46.0 + '@sentry/react': 7.46.0_react@18.2.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 '@sentry/webpack-plugin': 1.20.0 chalk: 3.0.0 next: 12.2.3_beenoklgwfttvph5dgxj7na7aq @@ -6923,13 +6932,14 @@ packages: - supports-color dev: false - /@sentry/node/7.42.0: - resolution: {integrity: sha512-mmpVSDeoM5aEbKOMq3Wt54wAvH53bkivhRh3Ip+R7Uj3aOKkcVJST2XlbghHgoYQXTWz+pl475EVyODWgY9QYg==} + /@sentry/node/7.46.0: + resolution: {integrity: sha512-+GrgJMCye2WXGarRiU5IJHCK27xg7xbPc2XjGojBKbBoZfqxVAWbXEK4bnBQgRGP1pCmrU/M6ZhVgR3dP580xA==} engines: {node: '>=8'} dependencies: - '@sentry/core': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry-internal/tracing': 7.46.0 + '@sentry/core': 7.46.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 cookie: 0.4.2 https-proxy-agent: 5.0.1 lru_map: 0.3.3 @@ -6938,49 +6948,46 @@ packages: - supports-color dev: false - /@sentry/react/7.42.0_react@18.2.0: - resolution: {integrity: sha512-DOGK+vuSZq5lTiqVU6wVay0AUMjtSPZu25gzLIXntfoqw36CLUswP7ew61+Tas6tpXDdf4lR3uxJRwySiQLopw==} + /@sentry/react/7.46.0_react@18.2.0: + resolution: {integrity: sha512-4U7gZ5XwzCgIAH00SJe2MEjJfZq1vB4M7/YYFTjfo5geVux/c+54xgVCxZiQpCaLJBJ5NoB9Fi47RrHbxauTGA==} engines: {node: '>=8'} peerDependencies: react: 15.x || 16.x || 17.x || 18.x dependencies: - '@sentry/browser': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/browser': 7.46.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 hoist-non-react-statics: 3.3.2 react: 18.2.0 tslib: 1.14.1 dev: false - /@sentry/replay/7.42.0: - resolution: {integrity: sha512-81HQm20hrW0+0eZ5sZf8KsSekkAlI0/u/M+9ZmOn2bHpGihqAM/O/lrXhTzaRXdpX/9NSwSCGY9k7LIRNMKaEQ==} + /@sentry/replay/7.46.0: + resolution: {integrity: sha512-rHsAFdeEu47JRy6mEwwN+M+zTTWlOFWw9sR/eDCvik2lxAXBN2mXvf/N/MN9zQB3+QnS13ke+SvwVW7CshLOXg==} engines: {node: '>=12'} dependencies: - '@sentry/core': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 + '@sentry/core': 7.46.0 + '@sentry/types': 7.46.0 + '@sentry/utils': 7.46.0 dev: false - /@sentry/tracing/7.42.0: - resolution: {integrity: sha512-0veGu3Ntweuj1pwWrJIFHmVdow4yufCreGIhsNDyrclwOjaTY3uI8iA6N62+hhtxOvqv+xueB98K1DvT5liPCQ==} + /@sentry/tracing/7.46.0: + resolution: {integrity: sha512-7qBtzmu7CDHclSKp+ZRrxoDcMyrev6/rxD2rSVJgB3o8gd2XGcO5vx9vuUOoYF0xTfOMXscR6Ft6JXE49xovYg==} engines: {node: '>=8'} dependencies: - '@sentry/core': 7.42.0 - '@sentry/types': 7.42.0 - '@sentry/utils': 7.42.0 - tslib: 1.14.1 + '@sentry-internal/tracing': 7.46.0 dev: false - /@sentry/types/7.42.0: - resolution: {integrity: sha512-Ga0xaBIR/peuXQ88hI9a5TNY3GLNoH8jpsgPaAjAtRHkLsTx0y3AR+PrD7pUysza9QjvG+Qux01DRvLgaNKOHA==} + /@sentry/types/7.46.0: + resolution: {integrity: sha512-2FMEMgt2h6u7AoELhNhu9L54GAh67KKfK2pJ1kEXJHmWxM9FSCkizjLs/t+49xtY7jEXr8qYq8bV967VfDPQ9g==} engines: {node: '>=8'} dev: false - /@sentry/utils/7.42.0: - resolution: {integrity: sha512-cBiDZVipC+is+IVgsTQLJyZWUZQxlLZ9GarNT+XZOZ5BFh0acFtz88hO6+S7vGmhcx2aCvsdC9yb2Yf+BphK6Q==} + /@sentry/utils/7.46.0: + resolution: {integrity: sha512-elRezDAF84guMG0OVIIZEWm6wUpgbda4HGks98CFnPsrnMm3N1bdBI9XdlxYLtf+ir5KsGR5YlEIf/a0kRUwAQ==} engines: {node: '>=8'} dependencies: - '@sentry/types': 7.42.0 + '@sentry/types': 7.46.0 tslib: 1.14.1 dev: false @@ -7378,12 +7385,12 @@ packages: resolution: {integrity: sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g==} dependencies: '@types/eslint': 8.4.3 - '@types/estree': 0.0.51 + '@types/estree': 1.0.0 /@types/eslint/8.4.3: resolution: {integrity: sha512-YP1S7YJRMPs+7KZKDb9G63n8YejIwW9BALq7a5j2+H4yl6iOv9CB29edho+cuFRrvmJbbaH2yiVChKLJVysDGw==} dependencies: - '@types/estree': 0.0.51 + '@types/estree': 1.0.0 '@types/json-schema': 7.0.11 /@types/estree/0.0.51: @@ -7391,7 +7398,6 @@ packages: /@types/estree/1.0.0: resolution: {integrity: sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==} - dev: false /@types/google.maps/3.49.1: resolution: {integrity: sha512-Sbl5anucT7LUcUxXsRxkCozHdXIkUiY+Tyru+OVl5rot0+VIZuuulmABC7X+nF7rL7BRTAguSBSAD/e/AfIkkA==} From e59c03682b0761a4b78797b785483e3f65222413 Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Fri, 31 Mar 2023 09:44:25 -0700 Subject: [PATCH 2/7] fix(sentry): enable `autoInstrumentServerFunctions` --- frontend/next.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/next.config.js b/frontend/next.config.js index cf7fd4cc..80e0e1b4 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -138,7 +138,6 @@ const moduleExports = { return config; }, sentry: { - autoInstrumentServerFunctions: false, // Upload artifacts in dist/framework as well; this includes sourcemaps // for react and other next.js code widenClientFileUpload: true, From d5ee360388eab119e39c699d3a1f1ce1d82a52f0 Mon Sep 17 00:00:00 2001 From: Mason McElvain <52104630+masonmcelvain@users.noreply.github.com> Date: Fri, 31 Mar 2023 09:44:50 -0700 Subject: [PATCH 3/7] debug: add a data fetcher that throws async --- frontend/pages/myPage.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 frontend/pages/myPage.tsx diff --git a/frontend/pages/myPage.tsx b/frontend/pages/myPage.tsx new file mode 100644 index 00000000..4dafa636 --- /dev/null +++ b/frontend/pages/myPage.tsx @@ -0,0 +1,16 @@ +import { GetServerSideProps } from 'next'; + +const MyComponent = () => { + return

Hello World!

; +}; + +export const getServerSideProps: GetServerSideProps = async (context) => { + if (context.query.myParam === 'two') { + // only throw conditionally so that this page actually builds + Promise.reject(new Error("We don't like page two")); + } + + return { props: {} }; +}; + +export default MyComponent; From 64845cd49a5a77f4ec2e546e8ac8eaabcd87c25c Mon Sep 17 00:00:00 2001 From: Daniel Beardsley Date: Fri, 31 Mar 2023 12:20:23 -0700 Subject: [PATCH 4/7] Dummy page: add way to return rejected promise --- frontend/pages/myPage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/pages/myPage.tsx b/frontend/pages/myPage.tsx index 4dafa636..4fe41d2f 100644 --- a/frontend/pages/myPage.tsx +++ b/frontend/pages/myPage.tsx @@ -5,9 +5,10 @@ const MyComponent = () => { }; export const getServerSideProps: GetServerSideProps = async (context) => { - if (context.query.myParam === 'two') { - // only throw conditionally so that this page actually builds + if (context.query.myParam === 'unhandled') { Promise.reject(new Error("We don't like page two")); + } else if (context.query.myParam === 'handled') { + return Promise.reject(new Error("We don't like page two")); } return { props: {} }; From bc28240b2be2f33ddaa914278dbd0fdebfd41e80 Mon Sep 17 00:00:00 2001 From: Daniel Beardsley Date: Fri, 31 Mar 2023 12:45:36 -0700 Subject: [PATCH 5/7] Sentry: update error page integration Ran "npx @sentry/wizard -i nextjs" and comitted the new eror page. The old one was similar, but was generated a year ago. --- frontend/pages/_error.js | 86 +++++++++++++------------------------- frontend/sentry.properties | 2 +- 2 files changed, 31 insertions(+), 57 deletions(-) diff --git a/frontend/pages/_error.js b/frontend/pages/_error.js index 9ab1a293..49f0ea6e 100644 --- a/frontend/pages/_error.js +++ b/frontend/pages/_error.js @@ -1,65 +1,39 @@ -import NextErrorComponent from 'next/error'; +/** + * NOTE: This requires `@sentry/nextjs` version 7.3.0 or higher. + * + * NOTE: If using this with `next` version 12.2.0 or lower, uncomment the + * penultimate line in `CustomErrorComponent`. + * + * This page is loaded by Nextjs: + * - on the server, when data-fetching methods throw or reject + * - on the client, when `getInitialProps` throws or rejects + * - on the client, when a React lifecycle method throws or rejects, and it's + * caught by the built-in Nextjs error boundary + * + * See: + * - https://nextjs.org/docs/basic-features/data-fetching/overview + * - https://nextjs.org/docs/api-reference/data-fetching/get-initial-props + * - https://reactjs.org/docs/error-boundaries.html + */ import * as Sentry from '@sentry/nextjs'; +import NextErrorComponent from 'next/error'; -const MyError = ({ statusCode, hasGetInitialPropsRun, err }) => { - if (!hasGetInitialPropsRun && err) { - // getInitialProps is not called in case of - // https://github.com/vercel/next.js/issues/8592. As a workaround, we pass - // err via _app.js so it can be captured - Sentry.captureException(err); - // Flushing is not required in this case as it only happens on the client - } +const CustomErrorComponent = props => { + // If you're using a Nextjs version prior to 12.2.1, uncomment this to + // compensate for https://github.com/vercel/next.js/issues/8592 + // Sentry.captureUnderscoreErrorException(props); - return ; + return ; }; -MyError.getInitialProps = async (context) => { - const errorInitialProps = await NextErrorComponent.getInitialProps(context); - - const { res, err, asPath } = context; - - // Workaround for https://github.com/vercel/next.js/issues/8592, mark when - // getInitialProps has run - errorInitialProps.hasGetInitialPropsRun = true; - - // Returning early because we don't want to log 404 errors to Sentry. - if (res?.statusCode === 404) { - return errorInitialProps; - } - - // Running on the server, the response object (`res`) is available. - // - // Next.js will pass an err on the server if a page's data fetching methods - // threw or returned a Promise that rejected - // - // Running on the client (browser), Next.js will provide an err if: - // - // - a page's `getInitialProps` threw or returned a Promise that rejected - // - an exception was thrown somewhere in the React lifecycle (render, - // componentDidMount, etc) that was caught by Next.js's React Error - // Boundary. Read more about what types of exceptions are caught by Error - // Boundaries: https://reactjs.org/docs/error-boundaries.html - - if (err) { - Sentry.captureException(err); - - // Flushing before returning is necessary if deploying to Vercel, see - // https://vercel.com/docs/platform/limits#streaming-responses - await Sentry.flush(2000); - - return errorInitialProps; - } - - // If this point is reached, getInitialProps was called without any - // information about what the error might be. This is unexpected and may - // indicate a bug introduced in Next.js, so record it in Sentry - Sentry.captureException( - new Error(`_error.js getInitialProps missing data at path: ${asPath}`) - ); - await Sentry.flush(2000); +CustomErrorComponent.getInitialProps = async contextData => { + // In case this is running in a serverless function, await this in order to give Sentry + // time to send the error before the lambda exits + await Sentry.captureUnderscoreErrorException(contextData); - return errorInitialProps; + // This will contain the status code of the response + return NextErrorComponent.getInitialProps(contextData); }; -export default MyError; +export default CustomErrorComponent; diff --git a/frontend/sentry.properties b/frontend/sentry.properties index bbd70d3e..aa16cef3 100644 --- a/frontend/sentry.properties +++ b/frontend/sentry.properties @@ -1,4 +1,4 @@ defaults.url=https://sentry.io/ defaults.org=ifixit defaults.project=react-commerce -cli.executable=../node_modules/@sentry/cli/bin/sentry-cli +cli.executable=../node_modules/.pnpm/@sentry+cli@1.75.0/node_modules/@sentry/cli/bin/sentry-cli From 1998b5a0c3fa07acfc2210136ea6a83e1bc8f739 Mon Sep 17 00:00:00 2001 From: Daniel Beardsley Date: Fri, 31 Mar 2023 12:48:49 -0700 Subject: [PATCH 6/7] Dummy page: update error messages to be distinct --- frontend/pages/myPage.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/pages/myPage.tsx b/frontend/pages/myPage.tsx index 4fe41d2f..96c62434 100644 --- a/frontend/pages/myPage.tsx +++ b/frontend/pages/myPage.tsx @@ -6,9 +6,9 @@ const MyComponent = () => { export const getServerSideProps: GetServerSideProps = async (context) => { if (context.query.myParam === 'unhandled') { - Promise.reject(new Error("We don't like page two")); + Promise.reject(new Error("This is an unhandled rejected promise")); } else if (context.query.myParam === 'handled') { - return Promise.reject(new Error("We don't like page two")); + return Promise.reject(new Error("This is a handled rejected promise")); } return { props: {} }; From 468d285f27ccfb4a4c7e51798c1c50b9f8dea8e2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 Mar 2023 19:49:54 +0000 Subject: [PATCH 7/7] style: apply prettier formatting diff --- frontend/pages/_error.js | 22 +++++++++++----------- frontend/pages/myPage.tsx | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frontend/pages/_error.js b/frontend/pages/_error.js index 49f0ea6e..f739fa90 100644 --- a/frontend/pages/_error.js +++ b/frontend/pages/_error.js @@ -19,21 +19,21 @@ import * as Sentry from '@sentry/nextjs'; import NextErrorComponent from 'next/error'; -const CustomErrorComponent = props => { - // If you're using a Nextjs version prior to 12.2.1, uncomment this to - // compensate for https://github.com/vercel/next.js/issues/8592 - // Sentry.captureUnderscoreErrorException(props); +const CustomErrorComponent = (props) => { + // If you're using a Nextjs version prior to 12.2.1, uncomment this to + // compensate for https://github.com/vercel/next.js/issues/8592 + // Sentry.captureUnderscoreErrorException(props); - return ; + return ; }; -CustomErrorComponent.getInitialProps = async contextData => { - // In case this is running in a serverless function, await this in order to give Sentry - // time to send the error before the lambda exits - await Sentry.captureUnderscoreErrorException(contextData); +CustomErrorComponent.getInitialProps = async (contextData) => { + // In case this is running in a serverless function, await this in order to give Sentry + // time to send the error before the lambda exits + await Sentry.captureUnderscoreErrorException(contextData); - // This will contain the status code of the response - return NextErrorComponent.getInitialProps(contextData); + // This will contain the status code of the response + return NextErrorComponent.getInitialProps(contextData); }; export default CustomErrorComponent; diff --git a/frontend/pages/myPage.tsx b/frontend/pages/myPage.tsx index 96c62434..66858662 100644 --- a/frontend/pages/myPage.tsx +++ b/frontend/pages/myPage.tsx @@ -6,9 +6,9 @@ const MyComponent = () => { export const getServerSideProps: GetServerSideProps = async (context) => { if (context.query.myParam === 'unhandled') { - Promise.reject(new Error("This is an unhandled rejected promise")); + Promise.reject(new Error('This is an unhandled rejected promise')); } else if (context.query.myParam === 'handled') { - return Promise.reject(new Error("This is a handled rejected promise")); + return Promise.reject(new Error('This is a handled rejected promise')); } return { props: {} };