Skip to content

fix(sveltekit): Rewrite server-side stack frames to match uploaded artifacts #7831

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 1 commit into from
Apr 13, 2023
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
1 change: 1 addition & 0 deletions packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dependencies": {
"@sentry-internal/tracing": "7.47.0",
"@sentry/core": "7.47.0",
"@sentry/integrations": "7.47.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated note: should we just export RewriteFrames from @sentry/core considering how much we use it everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could! Core would need to depend on integrations but this should be fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking opposite - integrations depends on core!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that also works 😅 I can do this but let's do it in another PR after this one

"@sentry/node": "7.47.0",
"@sentry/svelte": "7.47.0",
"@sentry/types": "7.47.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/sveltekit/src/server/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { configureScope } from '@sentry/core';
import { RewriteFrames } from '@sentry/integrations';
import type { NodeOptions } from '@sentry/node';
import { init as initNodeSdk, Integrations } from '@sentry/node';
import { addOrUpdateIntegration } from '@sentry/utils';
Expand All @@ -23,4 +24,5 @@ export function init(options: NodeOptions): void {

function addServerIntegrations(options: NodeOptions): void {
options.integrations = addOrUpdateIntegration(new Integrations.Undici(), options.integrations || []);
options.integrations = addOrUpdateIntegration(new RewriteFrames(), options.integrations || []);
}
6 changes: 5 additions & 1 deletion packages/sveltekit/src/vite/sourceMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import type { Plugin } from 'vite';

const DEFAULT_PLUGIN_OPTIONS: SentryVitePluginOptions = {
// TODO: Read these values from the node adapter somehow as the out dir can be changed in the adapter options
include: ['build/server', 'build/client'],
include: [
{ paths: ['build/client'] },
{ paths: ['build/server/chunks'] },
{ paths: ['build/server'], ignore: ['chunks/**'] },
],
};

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