From 2af8a6cab34720b3066963c2e9f37aff070ee2ad Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 11 Jun 2024 10:24:29 +0200 Subject: [PATCH 1/2] fix(astro): Ensure server-side exports work correctly --- packages/astro/src/index.server.ts | 4 +--- packages/astro/src/index.types.ts | 7 +++++-- packages/astro/src/server/sdk.ts | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 6657b3030cb1..4d73019afc3f 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -92,11 +92,9 @@ export { setupHapiErrorHandler, spotlightIntegration, addOpenTelemetryInstrumentation, + metrics, } from '@sentry/node'; -// We can still leave this for the carrier init and type exports -export * from '@sentry/node'; - export { init } from './server/sdk'; export default sentryAstro; diff --git a/packages/astro/src/index.types.ts b/packages/astro/src/index.types.ts index e5fe8fd965b4..2227679dff21 100644 --- a/packages/astro/src/index.types.ts +++ b/packages/astro/src/index.types.ts @@ -3,6 +3,9 @@ // exports in this file - which we do below. export * from './index.client'; export * from './index.server'; +export * from '@sentry/node'; + +import type { NodeOptions } from '@sentry/node'; import type { Integration, Options, StackParser } from '@sentry/types'; @@ -11,7 +14,7 @@ import type * as serverSdk from './index.server'; import sentryAstro from './index.server'; /** Initializes Sentry Astro SDK */ -export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void; +export declare function init(options: Options | clientSdk.BrowserOptions | NodeOptions): void; export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration; export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration; @@ -29,5 +32,5 @@ export declare const continueTrace: typeof clientSdk.continueTrace; export declare const Span: clientSdk.Span; -export declare const metrics: typeof clientSdk.metrics & typeof serverSdk.metrics; +export declare const metrics: typeof clientSdk.metrics & typeof serverSdk; export default sentryAstro; diff --git a/packages/astro/src/server/sdk.ts b/packages/astro/src/server/sdk.ts index c2398c7d019f..503557d6d7cd 100644 --- a/packages/astro/src/server/sdk.ts +++ b/packages/astro/src/server/sdk.ts @@ -10,6 +10,7 @@ export function init(options: NodeOptions): void { const opts = { ...options, }; + applySdkMetadata(opts, 'astro', ['astro', 'node']); initNodeSdk(opts); From cc1b529ac1d00e8c2c9ae27f36056e5c5f5d70cd Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 11 Jun 2024 11:10:53 +0200 Subject: [PATCH 2/2] add missing named exports from node --- packages/astro/src/index.server.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 4d73019afc3f..d1635cdada54 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -93,6 +93,32 @@ export { spotlightIntegration, addOpenTelemetryInstrumentation, metrics, + NodeClient, + addIntegration, + anrIntegration, + captureConsoleIntegration, + captureSession, + connectIntegration, + createGetModuleFromFilename, + debugIntegration, + dedupeIntegration, + endSession, + extraErrorDataIntegration, + getAutoPerformanceIntegrations, + httpIntegration, + initOpenTelemetry, + koaIntegration, + nativeNodeFetchIntegration, + rewriteFramesIntegration, + sessionTimingIntegration, + setupConnectErrorHandler, + setupKoaErrorHandler, + spanToBaggageHeader, + spanToJSON, + spanToTraceHeader, + startSession, + trpcMiddleware, + zodErrorsIntegration, } from '@sentry/node'; export { init } from './server/sdk';