Skip to content

Commit e804b41

Browse files
committed
feat(sveltekit): Switch to Otel-based @sentry/node package
1 parent bb6bd1f commit e804b41

File tree

14 files changed

+30
-36
lines changed

14 files changed

+30
-36
lines changed

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const DEPENDENTS: Dependent[] = [
9898
},
9999
{
100100
package: '@sentry/sveltekit',
101-
compareWith: nodeExperimentalExports,
101+
compareWith: nodeExports,
102102
exports: Object.keys(SentrySvelteKit),
103103
},
104104
];

packages/sveltekit/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"dependencies": {
4040
"@sentry-internal/tracing": "8.0.0-alpha.2",
4141
"@sentry/core": "8.0.0-alpha.2",
42-
"@sentry/node-experimental": "8.0.0-alpha.2",
42+
"@sentry/node": "8.0.0-alpha.2",
4343
"@sentry/svelte": "8.0.0-alpha.2",
4444
"@sentry/types": "8.0.0-alpha.2",
4545
"@sentry/utils": "8.0.0-alpha.2",

packages/sveltekit/src/index.types.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ export declare function handleErrorWithSentry<T extends HandleClientError | Hand
3636
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3737
export declare function wrapLoadWithSentry<T extends (...args: any) => any>(origLoad: T): T;
3838

39-
// We export a merged Integrations object so that users can (at least typing-wise) use all integrations everywhere.
40-
// eslint-disable-next-line deprecation/deprecation
41-
export declare const Integrations: typeof clientSdk.Integrations & typeof serverSdk.Integrations;
42-
4339
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
4440
export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration;
4541

4642
export declare const getDefaultIntegrations: (options: Options) => Integration[];
4743
export declare const defaultStackParser: StackParser;
4844

45+
export declare const getClient: typeof clientSdk.getClient;
46+
// eslint-disable-next-line deprecation/deprecation
47+
export declare const getCurrentHub: typeof clientSdk.getCurrentHub;
48+
// eslint-disable-next-line deprecation/deprecation
49+
export declare const makeMain: typeof clientSdk.makeMain;
50+
4951
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
5052
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
5153

packages/sveltekit/src/server/handle.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
withIsolationScope,
1111
} from '@sentry/core';
1212
import { startSpan } from '@sentry/core';
13-
import { captureException } from '@sentry/node-experimental';
13+
import { captureException } from '@sentry/node';
1414
import type { Span } from '@sentry/types';
1515
import { dynamicSamplingContextToSentryBaggageHeader, objectify } from '@sentry/utils';
1616
import type { Handle, ResolveOptions } from '@sveltejs/kit';

packages/sveltekit/src/server/handleError.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { captureException } from '@sentry/node-experimental';
1+
import { captureException } from '@sentry/node';
22
import type { HandleServerError } from '@sveltejs/kit';
33

44
import { flushIfServerless } from './utils';

packages/sveltekit/src/server/index.ts

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// Node SDK exports
2-
// Unfortunately, we cannot `export * from '@sentry/node-experimental'` because in prod builds,
2+
// Unfortunately, we cannot `export * from '@sentry/node'` because in prod builds,
33
// Vite puts these exports into a `default` property (Sentry.default) rather than
44
// on the top - level namespace.
55
// Hence, we export everything from the Node SDK explicitly:
66
export {
7-
// eslint-disable-next-line deprecation/deprecation
8-
addGlobalEventProcessor,
97
addEventProcessor,
108
addBreadcrumb,
119
addIntegration,
@@ -15,10 +13,6 @@ export {
1513
captureCheckIn,
1614
withMonitor,
1715
createTransport,
18-
// eslint-disable-next-line deprecation/deprecation
19-
getActiveTransaction,
20-
// eslint-disable-next-line deprecation/deprecation
21-
getCurrentHub,
2216
getClient,
2317
isInitialized,
2418
getCurrentScope,
@@ -41,7 +35,6 @@ export {
4135
setHttpStatus,
4236
withScope,
4337
withIsolationScope,
44-
autoDiscoverNodePerformanceMonitoringIntegrations,
4538
makeNodeTransport,
4639
getDefaultIntegrations,
4740
defaultStackParser,
@@ -51,7 +44,6 @@ export {
5144
addRequestDataToEvent,
5245
DEFAULT_USER_INCLUDES,
5346
extractRequestData,
54-
Integrations,
5547
consoleIntegration,
5648
onUncaughtExceptionIntegration,
5749
onUnhandledRejectionIntegration,
@@ -63,7 +55,6 @@ export {
6355
functionToStringIntegration,
6456
inboundFiltersIntegration,
6557
linkedErrorsIntegration,
66-
Handlers,
6758
setMeasurement,
6859
getActiveSpan,
6960
getRootSpan,
@@ -75,16 +66,15 @@ export {
7566
cron,
7667
parameterize,
7768
createGetModuleFromFilename,
78-
hapiErrorPlugin,
7969
metrics,
8070
SEMANTIC_ATTRIBUTE_SENTRY_OP,
8171
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
8272
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
8373
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
84-
} from '@sentry/node-experimental';
74+
} from '@sentry/node';
8575

8676
// We can still leave this for the carrier init and type exports
87-
export * from '@sentry/node-experimental';
77+
export * from '@sentry/node';
8878

8979
// -------------------------
9080
// SvelteKit SDK exports:

packages/sveltekit/src/server/load.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
continueTrace,
55
startSpan,
66
} from '@sentry/core';
7-
import { captureException } from '@sentry/node-experimental';
7+
import { captureException } from '@sentry/node';
88
import { addNonEnumerableProperty, objectify } from '@sentry/utils';
99
import type { LoadEvent, ServerLoadEvent } from '@sveltejs/kit';
1010

packages/sveltekit/src/server/sdk.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { applySdkMetadata, setTag } from '@sentry/core';
2-
import type { NodeOptions } from '@sentry/node-experimental';
3-
import { getDefaultIntegrations as getDefaultNodeIntegrations } from '@sentry/node-experimental';
4-
import { init as initNodeSdk } from '@sentry/node-experimental';
2+
import type { NodeOptions } from '@sentry/node';
3+
import { getDefaultIntegrations as getDefaultNodeIntegrations } from '@sentry/node';
4+
import { init as initNodeSdk } from '@sentry/node';
55

66
import { rewriteFramesIntegration } from './rewriteFramesIntegration';
77

packages/sveltekit/src/server/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { flush } from '@sentry/node-experimental';
1+
import { flush } from '@sentry/node';
22
import { logger } from '@sentry/utils';
33
import type { RequestEvent } from '@sveltejs/kit';
44

packages/sveltekit/src/vite/sourceMaps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as child_process from 'child_process';
22
import * as fs from 'fs';
33
import * as path from 'path';
4-
import { getSentryRelease } from '@sentry/node-experimental';
4+
import { getSentryRelease } from '@sentry/node';
55
import { escapeStringForRegex, uuid4 } from '@sentry/utils';
66
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
77
import { sentryVitePlugin } from '@sentry/vite-plugin';

packages/sveltekit/test/server/handle.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
spanIsSampled,
77
spanToJSON,
88
} from '@sentry/core';
9-
import { NodeClient, setCurrentClient } from '@sentry/node-experimental';
10-
import * as SentryNode from '@sentry/node-experimental';
9+
import { NodeClient, setCurrentClient } from '@sentry/node';
10+
import * as SentryNode from '@sentry/node';
1111
import type { Span } from '@sentry/types';
1212
import type { Handle } from '@sveltejs/kit';
1313
import { redirect } from '@sveltejs/kit';

packages/sveltekit/test/server/handleError.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as SentryNode from '@sentry/node-experimental';
1+
import * as SentryNode from '@sentry/node';
22
import type { HandleServerError, RequestEvent } from '@sveltejs/kit';
33
import { vi } from 'vitest';
44

packages/sveltekit/test/server/load.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import {
55
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
66
addTracingExtensions,
77
} from '@sentry/core';
8-
import { getClient, getCurrentScope, getIsolationScope, init } from '@sentry/node-experimental';
9-
import * as SentryNode from '@sentry/node-experimental';
8+
import { getClient, getCurrentScope, getIsolationScope, init } from '@sentry/node';
9+
import * as SentryNode from '@sentry/node';
1010
import type { Event } from '@sentry/types';
1111
import type { Load, ServerLoad } from '@sveltejs/kit';
1212
import { error, redirect } from '@sveltejs/kit';
@@ -151,7 +151,8 @@ describe.each([
151151
[504, 1],
152152
])('error with status code %s calls captureException %s times', async (code, times) => {
153153
async function load({ params }) {
154-
throw error(code, params.id);
154+
// @ts-expect-error - number is not assignable to NumericRange but that's fine here
155+
throw error(code, { message: params.id });
155156
}
156157

157158
const wrappedLoad = wrapLoadWithSentry(load);

packages/sveltekit/test/server/sdk.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import * as SentryNode from '@sentry/node-experimental';
2-
import type { NodeClient } from '@sentry/node-experimental';
3-
import { SDK_VERSION, getClient } from '@sentry/node-experimental';
1+
import * as SentryNode from '@sentry/node';
2+
import type { NodeClient } from '@sentry/node';
3+
import { SDK_VERSION, getClient } from '@sentry/node';
44

5+
import { vi } from 'vitest';
56
import { init } from '../../src/server/sdk';
67

78
const nodeInit = vi.spyOn(SentryNode, 'init');

0 commit comments

Comments
 (0)