From 31187dad1a39a797c00b9eeeb7911b471e3eef4b Mon Sep 17 00:00:00 2001 From: Dhenain Ambroise Date: Thu, 24 Jun 2021 17:59:13 +0200 Subject: [PATCH] Use '@sentry/node' instead of Sentry init --- src/layouts/core/components/CoreLayout.tsx | 7 +++++-- src/layouts/demo/components/DemoLayout.tsx | 2 +- src/layouts/quickPreview/components/QuickPreviewLayout.tsx | 2 +- src/modules/core/sentry/init.ts | 2 -- src/pages/api/error.ts | 2 +- src/pages/api/preview.ts | 2 +- src/pages/api/startVercelDeployment.ts | 2 +- src/pages/api/status.ts | 2 +- src/pages/api/webhooks/deploymentCompleted.ts | 2 +- 9 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/layouts/core/components/CoreLayout.tsx b/src/layouts/core/components/CoreLayout.tsx index ac90cd23..27b62375 100644 --- a/src/layouts/core/components/CoreLayout.tsx +++ b/src/layouts/core/components/CoreLayout.tsx @@ -3,13 +3,16 @@ import { GenericObject } from '@/modules/core/data/types/GenericObject'; import DefaultErrorLayout from '@/modules/core/errorHandling/DefaultErrorLayout'; import { createLogger } from '@/modules/core/logging/logger'; import PreviewModeBanner from '@/modules/core/previewMode/components/PreviewModeBanner'; -import Sentry from '@/modules/core/sentry/init'; import ErrorPage from '@/pages/_error'; import { Amplitude, LogOnMount, } from '@amplitude/react-amplitude'; -import { css, SerializedStyles } from '@emotion/react'; +import { + css, + SerializedStyles, +} from '@emotion/react'; +import * as Sentry from '@sentry/node'; import classnames from 'classnames'; import { NextRouter, diff --git a/src/layouts/demo/components/DemoLayout.tsx b/src/layouts/demo/components/DemoLayout.tsx index 6d5dc758..2df67d0c 100644 --- a/src/layouts/demo/components/DemoLayout.tsx +++ b/src/layouts/demo/components/DemoLayout.tsx @@ -3,12 +3,12 @@ import { GenericObject } from '@/modules/core/data/types/GenericObject'; import DefaultErrorLayout from '@/modules/core/errorHandling/DefaultErrorLayout'; import { createLogger } from '@/modules/core/logging/logger'; import PreviewModeBanner from '@/modules/core/previewMode/components/PreviewModeBanner'; -import Sentry from '@/modules/core/sentry/init'; import ErrorPage from '@/pages/_error'; import { Amplitude, LogOnMount, } from '@amplitude/react-amplitude'; +import * as Sentry from '@sentry/node'; import classnames from 'classnames'; import { NextRouter, diff --git a/src/layouts/quickPreview/components/QuickPreviewLayout.tsx b/src/layouts/quickPreview/components/QuickPreviewLayout.tsx index db65c883..6246dbfd 100644 --- a/src/layouts/quickPreview/components/QuickPreviewLayout.tsx +++ b/src/layouts/quickPreview/components/QuickPreviewLayout.tsx @@ -2,12 +2,12 @@ import Head, { HeadProps } from '@/layouts/core/components/CoreHead'; import { SoftPageProps } from '@/layouts/core/types/SoftPageProps'; import { GenericObject } from '@/modules/core/data/types/GenericObject'; import { createLogger } from '@/modules/core/logging/logger'; -import Sentry from '@/modules/core/sentry/init'; import { Amplitude, LogOnMount, } from '@amplitude/react-amplitude'; import { css } from '@emotion/react'; +import * as Sentry from '@sentry/node'; import React from 'react'; import { Container } from 'reactstrap'; import QuickPreviewBanner from './QuickPreviewBanner'; diff --git a/src/modules/core/sentry/init.ts b/src/modules/core/sentry/init.ts index 46ff83c9..df3deb54 100644 --- a/src/modules/core/sentry/init.ts +++ b/src/modules/core/sentry/init.ts @@ -41,5 +41,3 @@ if (process.env.SENTRY_DSN) { scope.setTag('runtimeEngine', isBrowser() ? 'browser' : 'server'); }); } - -export default Sentry; diff --git a/src/pages/api/error.ts b/src/pages/api/error.ts index d4c62579..1632b18d 100644 --- a/src/pages/api/error.ts +++ b/src/pages/api/error.ts @@ -4,9 +4,9 @@ import { AMPLITUDE_EVENTS, } from '@/modules/core/amplitude/events'; import { createLogger } from '@/modules/core/logging/logger'; -import Sentry from '@/modules/core/sentry/init'; import { configureReq } from '@/modules/core/sentry/server'; import { flushSafe } from '@/modules/core/sentry/universal'; +import * as Sentry from '@sentry/node'; import { NextApiRequest, NextApiResponse, diff --git a/src/pages/api/preview.ts b/src/pages/api/preview.ts index 7b91aa20..c346a041 100644 --- a/src/pages/api/preview.ts +++ b/src/pages/api/preview.ts @@ -5,9 +5,9 @@ import { } from '@/modules/core/amplitude/events'; import { filterExternalAbsoluteUrl } from '@/modules/core/js/url'; import { createLogger } from '@/modules/core/logging/logger'; -import Sentry from '@/modules/core/sentry/init'; import { configureReq } from '@/modules/core/sentry/server'; import { flushSafe } from '@/modules/core/sentry/universal'; +import * as Sentry from '@sentry/node'; import appendQueryParameter from 'append-query'; import { NextApiRequest, diff --git a/src/pages/api/startVercelDeployment.ts b/src/pages/api/startVercelDeployment.ts index 38f4ddd3..2d534744 100644 --- a/src/pages/api/startVercelDeployment.ts +++ b/src/pages/api/startVercelDeployment.ts @@ -7,8 +7,8 @@ import { import dispatchWorkflowByPath from '@/modules/core/githubActions/dispatchWorkflowByPath'; import { createLogger } from '@/modules/core/logging/logger'; import { ALERT_TYPES } from '@/modules/core/sentry/config'; -import Sentry from '@/modules/core/sentry/init'; import { configureReq } from '@/modules/core/sentry/server'; +import * as Sentry from '@sentry/node'; import size from 'lodash.size'; import { NextApiRequest, diff --git a/src/pages/api/status.ts b/src/pages/api/status.ts index 89f7c7de..8661757a 100644 --- a/src/pages/api/status.ts +++ b/src/pages/api/status.ts @@ -4,9 +4,9 @@ import { AMPLITUDE_EVENTS, } from '@/modules/core/amplitude/events'; import { createLogger } from '@/modules/core/logging/logger'; -import Sentry from '@/modules/core/sentry/init'; import { configureReq } from '@/modules/core/sentry/server'; import { flushSafe } from '@/modules/core/sentry/universal'; +import * as Sentry from '@sentry/node'; import { NextApiRequest, NextApiResponse, diff --git a/src/pages/api/webhooks/deploymentCompleted.ts b/src/pages/api/webhooks/deploymentCompleted.ts index 17122d0f..0ad5a75e 100644 --- a/src/pages/api/webhooks/deploymentCompleted.ts +++ b/src/pages/api/webhooks/deploymentCompleted.ts @@ -6,9 +6,9 @@ import { import { convertRequestBodyToJSObject } from '@/modules/core/api/convertRequestBodyToJSObject'; import { createLogger } from '@/modules/core/logging/logger'; import { ALERT_TYPES } from '@/modules/core/sentry/config'; -import Sentry from '@/modules/core/sentry/init'; import { configureReq } from '@/modules/core/sentry/server'; import { flushSafe } from '@/modules/core/sentry/universal'; +import * as Sentry from '@sentry/node'; import { NextApiRequest, NextApiResponse,