Skip to content

Sourcemaps not deleted after upload for Sveltekit deployed to Vercel #12660

Closed
@louiskhub

Description

@louiskhub

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

8.12.0

Framework Version

2.5.7

Link to Sentry event

No response

SDK Setup

In hooks.client.ts:

Sentry.init({
	dsn: PUBLIC_SENTRY_DSN,
	sampleRate: dev ? 0 : 1,
	tracesSampleRate: dev ? 0 : 1,
	replaysSessionSampleRate: environment === 'production' ? 0.1 : 0,
	replaysOnErrorSampleRate: environment === 'production' ? 0.1 : 0,
	integrations: environment === 'production' ? [Sentry.replayIntegration()] : [],
	debug: dev,
	environment,
	normalizeDepth: 10
});

In hooks.server.ts:

Sentry.init({
	dsn: PUBLIC_SENTRY_DSN,
	sampleRate: dev ? 0 : 1,
	tracesSampleRate: dev ? 0 : 1,
	debug: dev,
	environment,
	normalizeDepth: 10
});

My vite.config.ts:

import { paraglide } from '@inlang/paraglide-js-adapter-sveltekit/vite';
import { sentrySvelteKit } from '@sentry/sveltekit';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';

// @ts-expect-error mode is not defined in vite config
export default ({ mode }) => {
	return defineConfig({
		build: { sourcemap: true },
		plugins: [
			paraglide({
				project: './project.inlang',
				outdir: './src/lib/paraglide'
			}),
			sentrySvelteKit({
				sourceMapsUploadOptions: {
					org: '4eign',
					project: 'platform',
					authToken: process.env.SENTRY_AUTH_TOKEN_USER,
					sourcemaps: {
						filesToDeleteAfterUpload: [ './**/*.map' ]
					}
				},
				debug: mode === 'development',
				adapter: 'vercel'
			}),
			sveltekit()
		],
		test: {
			include: ['src/**/*.{test,spec}.{js,ts}']
		}
	});
};

Steps to Reproduce

  1. Deploy to vercel (running vite build)
  2. Expect that sourcemaps have been deleted and are not visible in browser devtools
  3. Observe that:
    • they have not been deleted (still visible in vercel source output)
    • they are still visible in browser devtools

Expected Result

Deleted sourcemaps

Actual Result

Visible sourcemaps

Metadata

Metadata

Assignees

Labels

Package: sveltekitIssues related to the Sentry SvelteKit SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions