Skip to content

Sentry does not seem to recognize valid sourcemaps #16189

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

Closed
3 tasks done
ktarmyshov opened this issue May 2, 2025 · 8 comments
Closed
3 tasks done

Sentry does not seem to recognize valid sourcemaps #16189

ktarmyshov opened this issue May 2, 2025 · 8 comments
Assignees

Comments

@ktarmyshov
Copy link

ktarmyshov commented May 2, 2025

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

"version": "9.15.0",

Framework Version

sveltekit "version": "2.20.8",

Link to Sentry event

https://konstantin-tarmyshov.sentry.io/issues/39901991/?project=4509255200669776&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=1

Reproduction Example/SDK Setup

Dear Sentry Team,

I am using this adapter (https://github.com/kt-npm-modules/svelte-adapter-azure-swa) which I updated specifically to address this issue (sveltejs/kit#10040). The app itself is here https://github.com/kt-npm-modules/svelte-adapter-azure-swa/tree/main/tests/demo.

I confirmed that the source maps seem to work just fine by starting swa-cli in the debug terminal and was able to set and stop at the breakpoints, like for example, sentry example GET API, which throws the error. If I switch off the sourcemaps in the vite, so only sourcemaps are generated by the adapter from .svelte-kit/out "sources". I am not able to set the active breakpoints any more. So vscode recognizes the sourcemaps generated by the rollup.

This is what I get in Sentry

Image

All green, but the Sentry does not show me any of the source code refs at all. This is the config:

		sentrySvelteKit({
			adapter: process.env.SWA ? 'other' : 'node',
			sourceMapsUploadOptions: {
				org: 'xxx',
				project: 'xxx',
				sourcemaps: {
					assets: ['./build/**/*', './func/**/*', './.svelte-kit/**/*']
				}
			}
		}),

what am I missing? Seems like a bug to me: VSCode recognizes sourcemaps, Sentry does not.

Konstantin

Steps to Reproduce

clone repo https://github.com/kt-npm-modules/svelte-adapter-azure-swa/tree/feat/sentry (branch feat/sentry)

npm run build:swa
npm run swa

Expected Result

I should be able to see normal mappings to the sources (stack trace)

Actual Result

I see trace in the final single azure function file.

@ktarmyshov
Copy link
Author

So I was able to resolve most of the issues:

Before I was bundling into one file, now I let rollup to split into chunks. Somehow sentry does not pickup the sourcemaps for the bundled Azure Functions properly - one single file or chunks.

Sentry Example Frontend Error
Seems to show the line ref ok, will check at some point if more complicated project is handled ok
https://konstantin-tarmyshov.sentry.io/issues/40075355/?project=4509255200669776&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=1

I however cannot connect the github sources.
This is the source file: https://github.com/kt-npm-modules/svelte-adapter-azure-swa/blob/main/tests/demo/src/routes/sentry-example-page/%2Bpage.svelte

I get the following error, when copy-pasting the url: Source code URL points to a different file than the stack trace

Sentry Example API Route Error
This one shows somewhat relevant info, but it seems it does not pick up the sourcemaps properly, it shows code of the bundled file.
https://konstantin-tarmyshov.sentry.io/issues/40075356/?project=4509255200669776&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&stream_index=0

@Lms24
Copy link
Member

Lms24 commented May 5, 2025

Hey, thanks for writing in! This might be related to sveltejs/kit#10040 indeed but not yet sure. Taking a look. Can't promise an ETA though as we're a bit busy with preparing for Svelte Summit and other tasks.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 May 5, 2025
@Lms24 Lms24 self-assigned this May 5, 2025
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 May 5, 2025
@ktarmyshov
Copy link
Author

Unless... binding to github still don't work, but minor.

Copy link
Member

lforst commented May 6, 2025

Nice. If the github bindings don't work I recommend reaching out to support or opening an issue in https://github.com/getsentry/sentry. It might be that you need to use the rewriteSources option of the underlying bundler plugin to get rid of all the ../../../.. in the file paths for the code mappings to GitHub to work.

@Lms24
Copy link
Member

Lms24 commented May 6, 2025

thanks for the update!

@Lms24 Lms24 closed this as completed May 6, 2025
@ktarmyshov
Copy link
Author

@lforst thanks for the info!

If understand correctly, I would add this to my rollup calls, and remove the @sentry/sveltekit plugin? In this case I would say the func should also go to the sk plugin as well. I guess adapter is not very right place to put it.

Or my understanding is incorrect?

Cause sk plugin seems to upload relative paths - so it does not resolve relative to process.cwd, does it?

@ktarmyshov
Copy link
Author

@lforst @Lms24

Oh, I found the options under unstable_sentryVitePluginOptions?: Partial<SentryVitePluginOptions>;. Guys, I'm gonna need suggestions. My understanding that this part runs as the part of the vite build process, and adapter runs after that (also with rollup) to bundle server and "re-bundle" (it's just translating file to file same structure with sourcemap rollup plugin) client to new destination, so the sourcemaps are correctly adjusted.

How to approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants