Skip to content

[@vercel/blob] Make ifMatch imply allowOverwrite, throw on contradiction#1022

Merged
vvo merged 2 commits intomainfrom
fix/ifmatch-implies-allow-overwrite
Mar 27, 2026
Merged

[@vercel/blob] Make ifMatch imply allowOverwrite, throw on contradiction#1022
vvo merged 2 commits intomainfrom
fix/ifmatch-implies-allow-overwrite

Conversation

@vvo
Copy link
Copy Markdown
Member

@vvo vvo commented Mar 26, 2026

Summary

Fixes the SDK-side of INC-5751. When a customer calls put() with ifMatch but without allowOverwrite: true, the server defaults allowOverwrite to false and sends both If-Match and If-None-Match: * to S3. S3 rejects this with 501 NotImplemented, surfaced as 500 to the customer.

  • When ifMatch is set without allowOverwrite, the SDK now implicitly sends x-allow-overwrite: 1 — because ifMatch (conditional update by ETag) inherently requires overwriting
  • When ifMatch is set with allowOverwrite: false, the SDK throws a clear BlobError explaining the contradiction

Server-side fix: vercel/api#65723

Validation

  • New test: put() with ifMatch and no allowOverwrite sends x-allow-overwrite: 1
  • New test: put() with ifMatch and allowOverwrite: false throws descriptive error
  • New test: put() with ifMatch and allowOverwrite: true works normally

🤖 Generated with Claude Code

When ifMatch is set without allowOverwrite, the SDK now implicitly sends
x-allow-overwrite: 1. When ifMatch is set with allowOverwrite: false,
the SDK throws a clear error explaining the contradiction.

This prevents the api-blob server from sending conflicting If-Match and
If-None-Match: * headers to S3, which caused 501 NotImplemented errors
surfaced as 500s to customers (INC-5751).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 26, 2026

🦋 Changeset detected

Latest commit: 96e0a4d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vercel/blob Patch
vercel-storage-integration-test-suite Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vercel-storage-next-integration-test-suite Ready Ready Preview Mar 27, 2026 5:15pm

Request Review

@vvo vvo requested a review from falcoagustin March 26, 2026 22:30
@vvo vvo marked this pull request as ready for review March 26, 2026 22:30
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vvo vvo merged commit 6dcecb8 into main Mar 27, 2026
10 checks passed
@vvo vvo deleted the fix/ifmatch-implies-allow-overwrite branch March 27, 2026 17:06
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.

2 participants