Skip to content

fix(bundler-plugins): Log and propagate source map deletion errors in deleteArtifacts - #26961

Open
RealAdii wants to merge 1 commit into
getsentry:developfrom
RealAdii:fix/26960-log-sourcemap-delete-errors
Open

RealAdii wants to merge 1 commit into
getsentry:developfrom
RealAdii:fix/26960-log-sourcemap-delete-errors

Conversation

@RealAdii

Copy link
Copy Markdown

What

Reports each source map that could not be deleted after upload as an error and propagates the failure to the configured error handler, matching deleteFromOutput.

Why

deleteArtifacts previously swallowed all fs.promises.rm errors with logger.debug, allowing builds to exit successfully even when permission or filesystem errors prevented source maps from being deleted from disk.

Closes: #26960

… deleteArtifacts

When sourcemap deletion after upload fails, report the failed map as an error and propagate the failure to the error handler rather than silently swallowing it.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions github-actions Bot added the external PR from an external contributor label Nov 28, 2026
@timfish

timfish commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

when permission or filesystem errors prevented source maps from being deleted from disk

What causes this?

@RealAdii

Copy link
Copy Markdown
Author

In practice, the two main cases where fs.promises.rm(..., { force: true }) rejects are:

  1. Windows file locks (EBUSY / EPERM) — e.g. Windows Defender, search indexers, or another post-build plugin/watcher still holding a handle on a .map file when deleteArtifacts runs.
  2. Container / CI volume permission mismatches (EACCES / EROFS) — e.g. multi-step CI jobs or Docker bind mounts where build output was produced or chowned under a different UID/read-only layer before the post-compile hook runs.

For context on why this path behaved differently from deleteFromOutput right above it: deleteArtifacts already has the outer catch comment ("We throw by default if we get here b/c not being able to delete source maps could leak them to production") calling handleRecoverableError(e, true), and { force: true } already ignores ENOENT. However, the inner .catch() from sentry-javascript-bundler-plugins#373 swallowed non-ENOENT rm rejections before they could reach that outer handler.

This branch has not been deployed

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

Labels

external PR from an external contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[nextjs] deleteSourcemapsAfterUpload leaves a source map it fails to delete in the build output and logs it at debug level only

2 participants