Skip to content

fix(astro): Ensure server-side exports work correctly #12453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,35 @@ export {
setupHapiErrorHandler,
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';

// We can still leave this for the carrier init and type exports
export * from '@sentry/node';

export { init } from './server/sdk';

export default sentryAstro;
Expand Down
7 changes: 5 additions & 2 deletions packages/astro/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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;
Expand All @@ -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;
1 change: 1 addition & 0 deletions packages/astro/src/server/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function init(options: NodeOptions): void {
const opts = {
...options,
};

applySdkMetadata(opts, 'astro', ['astro', 'node']);

initNodeSdk(opts);
Expand Down
Loading