Skip to content

upload js crashes with "open : no such file or directory" when .map has no same-name .js bundle #268

@kaisermann

Description

@kaisermann

When running bugsnag-cli upload js .next/ on a Next.js Turbopack build, the CLI crashes with:

open : no such file or directory

The error is missing the filename, which made this very hard to debug on our Vercel production builds.

What's happening: Turbopack uses independent content hashes for .js bundles and their .js.map files. A bundle abc123.js contains //# sourceMappingURL=def456.js.map. The map file exists on disk, but there is no def456.js. This is intentional on Turbopack's side (vercel/next.js#85471).

The crash happens because resolveBundlePath strips .map to find the bundle. When the file doesn't exist, it returns an empty string with no error. That empty string reaches os.Open(""), which panics.

Suggestions:

  1. When no bundle is found for a map file, skip it with a warning or return a clear error instead of crashing.
  2. Would you consider reading //# sourceMappingURL= comments from .js files to discover the actual pairing? The Turbopack maintainers consider this the standard mechanism (their response). It would work regardless of how the bundler names its output files.

Minimal repro with build output included: https://github.com/kaisermann/turbopack-sourcemap-repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs discussionRequires internal analysis/discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions