Skip to content

Sourcemap chain breaks when multiple build steps inject Debug IDs #1916

@JPeer264

Description

@JPeer264

(original issue: getsentry/sentry-javascript#20051)

I'm currently not sure if this is a bug or a feature, but I guess that this is more likely a feature.

Problem

When a JavaScript bundle is built through multiple build tools (each generating their own sourcemaps), Symbolicator currently cannot follow the full sourcemap chain when Debug IDs are present in intermediate artifacts. In this case this is mandatory for running frameworks on Cloudflare, as there is the first build step for the framework itself, and then another one for Cloudflare Workers (that is bundling again, but everything into 1 file).

Since the Cloudflare usage is increasing quite heavily, and Cloudflare itself is also pushing to move frameworks to their platform, it would make sense to support this.

Current Behavior

Pipeline of the reproduction repo
flowchart LR
    subgraph Original["Original Source"]
        A["server/api/error.ts"]
    end
    
    subgraph Nuxt["Nuxt Build"]
        B[".output/server/chunks/*"]
        B1["+ debug ID #1"]
        B2["+ sourcemap → original"]
    end
    
    subgraph Cloudflare["Wrangler Build"]
        C["dist/index.js"]
        C1["+ debug ID #2"]
        C2["+ sourcemap → .output files"]
    end
    
    A --> B
    B --> C
Loading

Upload Nuxt and Cloudflare sourcemaps

When sourcemaps of both builds are uploaded to Sentry then the original source code is not shown and it looks like this:

Comparable errors
Nuxt Cloudflare
Image Image Image
Example link https://sentry-sdks.sentry.io/issues/7377327036/?project=4510555608449024&query=is%3Aunresolved&referrer=issue-stream https://sentry-sdks.sentry.io/issues/7379743666/?project=4510555608449024&query=is%3Aunresolved&referrer=issue-stream

Upload only Cloudflare sourcemaps

When only the final (Cloudflare) sourcemap is uploaded (assuming that the first bundle never got injected with debug ids) then the Cloudflare errors are shown correctly, but the SSR issues won't render correctly, as the sourcemaps are missing:

Comparable errors
Nuxt Cloudflare
Image Image Image
Example link https://sentry-sdks.sentry.io/issues/7382232299/?project=4510555608449024&query=is%3Aunresolved&referrer=issue-stream https://sentry-sdks.sentry.io/issues/7382487252/?project=4510555608449024&query=is%3Aunresolved&referrer=issue-stream

Expected Behavior

The actual source code should be visible on errors when the sourcemaps of both builds are uploaded.

Reproduction

The current reproduction of this behavior done by following the guide in the following repo: https://github.com/JPeer264/temp-symbolicator-nuxt-wrangler

Example Sentry issues:

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions