Skip to content

Commit 7b50bfa

Browse files
authored
fix(sveltekit): Rewrite server-side stack frames to match source maps (#7831)
Add the `RewriteFrames` integration to match the server-side stack frames with the uploaded source maps.
1 parent 3503b91 commit 7b50bfa

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

packages/sveltekit/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"dependencies": {
2323
"@sentry-internal/tracing": "7.47.0",
2424
"@sentry/core": "7.47.0",
25+
"@sentry/integrations": "7.47.0",
2526
"@sentry/node": "7.47.0",
2627
"@sentry/svelte": "7.47.0",
2728
"@sentry/types": "7.47.0",

packages/sveltekit/src/server/sdk.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { configureScope } from '@sentry/core';
2+
import { RewriteFrames } from '@sentry/integrations';
23
import type { NodeOptions } from '@sentry/node';
34
import { init as initNodeSdk, Integrations } from '@sentry/node';
45
import { addOrUpdateIntegration } from '@sentry/utils';
@@ -23,4 +24,5 @@ export function init(options: NodeOptions): void {
2324

2425
function addServerIntegrations(options: NodeOptions): void {
2526
options.integrations = addOrUpdateIntegration(new Integrations.Undici(), options.integrations || []);
27+
options.integrations = addOrUpdateIntegration(new RewriteFrames(), options.integrations || []);
2628
}

packages/sveltekit/src/vite/sourceMaps.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import type { Plugin } from 'vite';
99

1010
const DEFAULT_PLUGIN_OPTIONS: SentryVitePluginOptions = {
1111
// TODO: Read these values from the node adapter somehow as the out dir can be changed in the adapter options
12-
include: ['build/server', 'build/client'],
12+
include: [
13+
{ paths: ['build/client'] },
14+
{ paths: ['build/server/chunks'] },
15+
{ paths: ['build/server'], ignore: ['chunks/**'] },
16+
],
1317
};
1418

1519
// sorcery has no types, so these are some basic type definitions:

0 commit comments

Comments
 (0)