-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Sourcemaps not working for Vercel + Sveltekit (paths for stack trace frames are absolute from the root filesystem rather than relative) #10089
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 @fnimick thanks for writing in! Can you show me your Based on #8256, our Vite plugin should read the output directory during build and hand it to the server side SDK of Sentry. The SDK will rewrite the stack frame filenames, removing the absolute path before the output directory. |
sentrySvelteKit({
adapter: "vercel",
autoUploadSourceMaps: process.env.PUBLIC_SENTRY_DISABLED !== "true",
sourceMapsUploadOptions: {
org: "million-marker",
project: "future",
},
autoInstrument: false,
}),
sveltekit(), .....etc This config hasn't changed since our first integration (which had no source map issues), so I doubt it's the source of the problem? |
I have a couple of concrete questions to debug this (alternatively, please feel free to provide a minimal reproducible example as a GH repo so we can debug it ourselves):
Sentry.init({
dsn: 'DSN',
// rest of your options
beforeSend(event) {
console.log(globalThis.__sentry_sveltekit_output_dir);
return event;
}
}); I have a feeling that this global value might not be set correctly but we need to verify this first. |
Source map logs are attached - looks like there are problems associating the files right away. (Unfortunately all the earlier logs are truncated due to vercel's 2000 line log storage limit). The log for the |
Hmm yeah good point. I'm not sure what's causing this though.
Thanks, this rules out my first suspicion. Can you confirm that you're building your projects artifacts into It's very hard to debug this without a reproduction at hand. If you're not able to provide one, I can only suggest you to debug our custom Depending on the package manager, you'll find this function somewhere close to |
@Lms24 I think I solved part of it! I was accidentally initializing sentry twice in my server process, once I stopped doing that, the frames are being rewritten correctly. However, I still have a problem with the sourcemaps. As an example, I have an error with a stack frame path of If I look at the release's artifacts, there is a file with that exact path - see bundle |
@fnimick just to sanity check, can you run |
@fnimick apologies, I missed what was right in front of me: The uppermost stack frame in the errors associated with the linked release is already resolved and it should show you your sources content. You can see this because the file name already points to your source file, so it went through our source map symbolication process. In fact, our source maps debugger (the component that opens when you click "Unminify Code") shouldn't be shown on the uppermost frame, as it is already resolved. That's a bug on our end and we're already aware of it. Sorry for the confusion! The frames below the top frame still seem to be unresolved but they originate from SvelteKit source code, meaning that this is not relevant for the caught errors. For some reason the |
@Lms24 I think I have a potential answer for you. My main build is accidentally calling edit: removed question around "how to detect double initialization" - it's much easier to not do that in the first place. |
@fnimick Thanks for the reply - can we close this issue or is there anything still open from your end? (apart from the known issue of the debugger pill showing up in the UI although the frame was symbolicated) |
Yes, this can be closed now - thank you! I'm working with Inngest to improve their docs on Sentry integration, which currently uses a |
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
7.92.0
Framework Version
Sveltekit 2.0.6
Link to Sentry event
https://million-marker.sentry.io/issues/4829645193/
SDK Setup
Steps to Reproduce
At some point (not clear when), errors are being captured with the absolute path of the running file in the stack track frame (e.g.
/var/task/vercel/path0/.svelte-kit/output/server/entries/endpoints/sentry-example/_server.js
) rather than the expected relative stack track frame. This means that the sourcemaps are not matching, since the source map path being searched for is~/var/task/vercel/path0/.svelte-kit/output/server/entries/endpoints/sentry-example/_server.js
and the actual source map path from my uploaded artifact is~/entries/endpoints/sentry-example/_server.js
.Expected Result
The stack trace should contain a relative frame which corresponds to generated source maps.
Actual Result
The stack trace frame is the full path, from the root
/
, of the running file in the Vercel VM.The text was updated successfully, but these errors were encountered: