From f42330ccf93b5418068e8e0945f2bb94e7fc8c39 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 14 Feb 2023 12:34:47 +0000 Subject: [PATCH 1/4] fix(nextjs): Fix faulty import in Next.js .d.ts --- packages/nextjs/src/index.types.ts | 17 +++++++++-------- packages/nextjs/src/server/index.ts | 2 ++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/nextjs/src/index.types.ts b/packages/nextjs/src/index.types.ts index aca9f9d48211..0b115d213d5d 100644 --- a/packages/nextjs/src/index.types.ts +++ b/packages/nextjs/src/index.types.ts @@ -9,18 +9,19 @@ export * from './edge'; import type { Integration, Options, StackParser } from '@sentry/types'; -import type { BrowserOptions } from './client'; -import * as clientSdk from './client'; -import type { EdgeOptions } from './edge'; -import * as edgeSdk from './edge'; -import type { NodeOptions } from './server'; -import * as serverSdk from './server'; +import type * as clientSdk from './client'; +import type * as edgeSdk from './edge'; +import type * as serverSdk from './server'; /** Initializes Sentry Next.js SDK */ -export declare function init(options: Options | BrowserOptions | NodeOptions | EdgeOptions): void; +export declare function init( + options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions | edgeSdk.EdgeOptions, +): void; // We export a merged Integrations object so that users can (at least typing-wise) use all integrations everywhere. -export const Integrations = { ...clientSdk.Integrations, ...serverSdk.Integrations, ...edgeSdk.Integrations }; +export declare const Integrations: typeof clientSdk.Integrations & + typeof serverSdk.Integrations & + typeof edgeSdk.Integrations; export declare const defaultIntegrations: Integration[]; export declare const defaultStackParser: StackParser; diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 9afdedd9ae91..8715c16aeb5f 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -15,6 +15,8 @@ import { addOrUpdateIntegration } from '../common/userIntegrations'; import { isBuild } from './utils/isBuild'; export * from '@sentry/node'; +export { Integrations }; + export { captureUnderscoreErrorException } from '../common/_error'; /** From 3b0257fb9d616a4215c785cd7175992a597d43c8 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 14 Feb 2023 12:35:41 +0000 Subject: [PATCH 2/4] Add to test --- .../test-applications/create-next-app/sentry.server.config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts b/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts index e3d70f17e126..2ddae3d93340 100644 --- a/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts +++ b/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts @@ -17,7 +17,9 @@ Sentry.init({ // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so - // that it will also get attached to your source maps + // that it will also get attached to your source maps, + + integrations: [new Sentry.Integrations.LocalVariables()], }); Sentry.addGlobalEventProcessor(event => { From 101fc7df7227886116fb3f977e3a8ecd34174219 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 14 Feb 2023 13:03:21 +0000 Subject: [PATCH 3/4] Remove testing leftover --- packages/nextjs/src/server/index.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/nextjs/src/server/index.ts b/packages/nextjs/src/server/index.ts index 8715c16aeb5f..9afdedd9ae91 100644 --- a/packages/nextjs/src/server/index.ts +++ b/packages/nextjs/src/server/index.ts @@ -15,8 +15,6 @@ import { addOrUpdateIntegration } from '../common/userIntegrations'; import { isBuild } from './utils/isBuild'; export * from '@sentry/node'; -export { Integrations }; - export { captureUnderscoreErrorException } from '../common/_error'; /** From 2287eeda830a9a696ce8cfecee1e031dbeea5f7d Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Tue, 14 Feb 2023 14:03:52 +0100 Subject: [PATCH 4/4] Update packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts Co-authored-by: Abhijeet Prasad --- .../test-applications/create-next-app/sentry.server.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts b/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts index 2ddae3d93340..b5673c598d71 100644 --- a/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts +++ b/packages/e2e-tests/test-applications/create-next-app/sentry.server.config.ts @@ -17,7 +17,7 @@ Sentry.init({ // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so - // that it will also get attached to your source maps, + // that it will also get attached to your source maps integrations: [new Sentry.Integrations.LocalVariables()], });