-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
adapter-node
breaks paths to sourcemap sources by copying files during build
#10040
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
Comments
Hi, Sentry dev 👋 I asked about this a while ago here along with some other source maps related stuff: #9608 We would really appreciate it if this was fixed. Ideally, the source maps from the Node adapter would directly map to the actual sources and not the built files in Thanks! |
Adding a +1 on this! It's crazy difficult to track client-side errors without it, and we're building into a custom express server that runs a ton of legacy code, so we can't afford to use anything other than |
Since this got rolled back, has anyone seen anything about when they'll reattempt the adapter-node sourcemap fix? Clientside sentry is unusable until that gets resolved :( |
I'm wondering if a simple option might be just changing the output path in the node adapter to match the original directory hierarchy? |
I think this was fixed in #10041 |
We would really appreciate it if this issue was bumped in priority. The current behaviour is blocking some of our users because our source maps flattening approach with My request would be that Obviously, it's not ideal that the path to the source files isn't correct at the moment but at least this doesn't fully block our users. |
Outstanding upstream issues need to be fixed first: - sveltejs/kit#10040 - getsentry/sentry-javascript#10589
@Rich-Harris this is stopping us from using sentry in a way so we can read the stack traces. |
I've just put some effort into getting sourcemaps working for our app. Here's what worked:
This seems sufficient for getting errors reporting with their correct source locations I'm unsure if/how this relates the the original issue - whilst the script I made does patch the sources paths to remove the extra '../', all that seems to really have an affect on is the final rendered source line (i.e. without it will be one directory too high). Sourcemaps are dark magic to me so i'm not sure what the real end fix is, but these steps have given us useful error messages in production at least. |
@Lms24 Hi, Lukas, Anyways, after fixing sourcemaps with re-bundling client js files (could be a solution for any other adapter or even for writeClient/writeServer for the builder), Sentry seems to work and pickup sourcemaps for the client, but fails to do so for the backend part. VSCode debugging works just fine and picks up the sourcemaps. Could you take at the issue on Sentry side? Thank you |
Describe the bug
When you turn on sourcemaps in Vite, SvelteKit will generate sourcemaps even for the server. This is great! But during the build,
@sveltejs/adapter-node
moves the generated files, for example from.svelte-kit/output/server/foo.js
to.svelte-kit/adapter-node/foo.js
, breaking the relative paths to the sources in the sourcemaps.This is the code that moves the files:
kit/packages/kit/src/core/adapt/builder.js
Lines 207 to 209 in 51f3e66
I noticed this because I wanted to setup Sentry's new SvelteKit integration, but the sourcemaps would just not work. Sentry is actually using sorcery to try to flatten all the sourcemaps from the different steps of the build: https://github.com/getsentry/sentry-javascript/blob/41fef4b10f3a644179b77985f00f8696c908539f/packages/sveltekit/src/vite/sourceMaps.ts#L136-L139
This almost works, except that
adapter-node
moves the files, thus breaking the chain.A fix could be to update the source maps while copying them. (But maybe there are better options.)
Reproduction
Repo: https://github.com/danieldiekmeier/reproduction-adapter-node-sourcemaps
pnpm i pnpm build diff .svelte-kit/output/server/chunks/index.js.map .svelte-kit/adapter-node/chunks/index.js.map # nothing will be printed, which is the problem: it's the same file
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: