Skip to content

Problem with Server Sourcemaps in SvelteKit #8218

Description

@danieldiekmeier

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.53.1

Framework Version

1.18.0

Link to Sentry event

https://eintrittskartenio.sentry.io/issues/4208536907/?environment=development&project=1422627&query=is%3Aunresolved&referrer=issue-stream&stream_index=0

SDK Setup

Sentry.init({dsn: config.SENTRY,tracesSampleRate: 0.05,environment: 'development',release: 'c52cb50081964beca7ba61bcd8c113d7',})

Steps to Reproduce

  1. I ran npx @sentry/wizard@latest -i sveltekit to automatically add Sentry to my SvelteKit Application
  2. I manually put build: { sourcemaps: true } in my vite.config.js, because I want sourcemaps for the server
  3. I built my app (vite build), started it (node ./build) and triggered an error locally
  4. I noticed that Sentry stopped showing any code at all in the traces:

telegram-cloud-photo-size-2-5440698828241094581-y

  1. I dug as deep as I could and noticed that the relative paths in the sourcemaps are slightly wrong. They go one level too far up. For example, it would show ../../../../src/routes/+page.svelte, but relative to build/server/chunks, this is outside of my project folder. So I checked where these paths get set, and ended up creating this bug report in the SvelteKit repo: adapter-node breaks paths to sourcemap sources by copying files during build sveltejs/kit#10040
  2. I worked around the bug locally, but I also noticed that the directories of the files are now omitted (instead it prepends app://), showing only the filename. In a typical SvelteKit app, many many files are called +page or +layout, so this is less than ideal. :D

Expected Result

The full path to the file should be shown.

Actual Result

image

Previously, when I didn't use sourcemaps, it showed the whole filepath:

Screenshot 2023-05-26 00 43 48@2x

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions