Skip to content

fix(cli): handle 413 payload-too-large errors for SBOM scans#545

Merged
facundo-herodevs merged 1 commit intomainfrom
742-handle-413-errors
Apr 15, 2026
Merged

fix(cli): handle 413 payload-too-large errors for SBOM scans#545
facundo-herodevs merged 1 commit intomainfrom
742-handle-413-errors

Conversation

@facundo-herodevs
Copy link
Copy Markdown
Member

@facundo-herodevs facundo-herodevs commented Apr 15, 2026

Closes https://github.com/neverendingsupport/data-and-integrations/issues/742

What This Branch Does

This branch adds explicit oversized-upload handling to the SBOM scan flow so 413 Request Entity Too Large responses no longer fall back to generic scan failures. It propagates the error from createAuthorizedFetch through SbomScanner and shows the right user-facing message from ScanEol.scanSbom depending on whether the SBOM came from --file or was generated locally.

413 Error Propagation

CLI Scan Messaging

  • Adds a dedicated 413 branch inside ScanEol.scanSbom in src/commands/scan/eol.ts so scans fail with a specific oversized-upload message before falling back to the existing auth/general error mapping.
  • Keeps the user-facing copy local to ScanEol.getPayloadTooLargeMessage, which returns the --file message for user-supplied SBOMs and the smaller-scope guidance for generated SBOMs.
  • Preserves the existing analytics path in ScanEol.scanSbom, so CLI EOL Scan Failed still records the API error code and scan timing when the server rejects the upload.

Examples

./bin/run.js scan eol --file /tmp/oversized-sbom.json

✔ Loaded SBOM file
✔ SBOM trimmed
✖ Scanning failed
 ›   Error: File exceeds the 10MB limit. Try providing a smaller or partial SBOM.
./bin/run.js scan eol --dir /tmp/sbom-node-modules-huge

✔ Generated SBOM
✔ SBOM trimmed
✖ Scanning failed
 ›   Error: Generated SBOM exceeds the 10MB upload limit. Try scanning a smaller scope (e.g. a single project or subdirectory).

@facundo-herodevs facundo-herodevs requested a review from a team as a code owner April 15, 2026 15:42
@facundo-herodevs facundo-herodevs merged commit 2cbc52b into main Apr 15, 2026
12 checks passed
@facundo-herodevs facundo-herodevs deleted the 742-handle-413-errors branch April 15, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants