getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8.02k stars 1.59k forks source link

Sveltekit build fails with sourcemap deletion enabled #14131

Open dollannn opened 3 weeks ago

dollannn commented 3 weeks ago

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/sveltekit

SDK Version

8.35.0

Framework Version

Latest svelte

Link to Sentry event

No response

Reproduction Example/SDK Setup

Latest svelte 5 repro, I am myself using svelte 4 in the project actually being affected by this:

https://github.com/dollannn/sentry-repro

Steps to Reproduce

Enable sourcemap deletion in vite.config.ts Try to build

error during build

Expected Result

Sourcemaps being deleted and the build not failing

Actual Result

error during build: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s)oon exit: on exit: on exit: (sentry-file-deletion-plugin) writeBundle at process.handleBeforeExit (file:///D:/Projects/test/sentry-repro/node_modules/.pnpm/rollup@4.24.3/node_modules/rollup/dist/es/shared/node-entry.js:21098:28) at Object.onceWrapper (node:events:634:26) at process.emit (node:events:531:35)  ELIFECYCLE  Command failed with exit code 1.

Lms24 commented 3 weeks ago

Hey, thanks for reporting! I'll take a look soon.

dollannn commented 2 weeks ago

Any progress on this?

Lms24 commented 2 weeks ago

Hey, sorry for the wait! Taking a look right now

Lms24 commented 2 weeks ago

So, I have some preliminary findings but unfortunately no fix yet. A couple of months ago, we changed how we wait with deleting files until they're fully processed in the @sentry/vite-plugin. Unfortunately, these plugin changes had some side effects in the SvelteKit package because the sentrySvelteKit vite plugin function modifies the @sentry/vite-plugin function quite a lot to make it work with SvelteKit'S build config. This currently leads to the plugin awaiting a promise that doesn't resolve correctly. I'm gonna debug this a bit more tomorrow and hopefully find a fix.