Skip to content

fix: allow saving media after a focal point change - #96

Merged
InnerDesires merged 1 commit into
mainfrom
claude/media-save-focal-point-1a809d
Aug 14, 2026
Merged

InnerDesires merged 1 commit into
mainfrom
claude/media-save-focal-point-1a809d

Conversation

@InnerDesires

Copy link
Copy Markdown
Owner

Problem

Saving a media document after changing its focal point in the admin image editor failed with a generic Something went wrong. toast. The underlying response was a 500:

ERROR: There was an error while uploading files corresponding to the collection media with filename image-hero1-1.webp:
ERROR: Vercel Blob: This blob already exists, use `allowOverwrite: true` if you want to overwrite it.
    at uploadFile → Object.handleUpload → updateDocument → updateByIDOperation
PATCH /api/media/5?...uploadEdits[focalPoint][x]=65&uploadEdits[focalPoint][y]=20  500

Root cause

Not a focal-point bug — a blob re-upload bug.

The admin sends uploadEdits[crop] alongside the focal point on save, which makes Payload regenerate the original file plus all 7 image sizes and re-upload them under the same filenames. @payloadcms/storage-vercel-blob@3.86.0 calls @vercel/blob's put() without allowOverwrite, and that defaults to false in @vercel/blob v2 — so every re-upload was rejected.

This affected production as well, since prod also has BLOB_READ_WRITE_TOKEN set.

Fix

Upstream fixed this in 3.87.0 by passing allowOverwrite: true in uploadFile.ts. Version 3.86.0 exposes no config option to set it, so the whole Payload suite is bumped 3.86.0 → 3.87.0 — the storage adapter pins payload exactly as a peer dependency, so a partial bump would drift.

src/payload-types.ts and src/app/(payload)/admin/importMap.js are regenerated output. The type churn is purely structural (MediaBlock/ArchiveBlock hoisted from inline definitions to named interfaces, payload-mcp-api-keys reordered) — no interfaces or fields added or removed.

No migration needed

Verified by diffing the published tarballs for both versions:

  • payload/dist/database — identical
  • @payloadcms/db-postgres/dist — byte-identical

Verification

  • Reproduced the 500 before the fix, in the real admin UI.
  • After the fix, the full admin flow (open editor → set X/Y → Застосувати зміни → Зберегти) returns 200, and re-reading /api/media/5 confirms focalX/focalY persisted 65/20 → 25/80 with sizes regenerated under the same filenames.
  • Fresh upload still works (201, 7 sizes generated), and a focal edit on that new doc also returns 200.
  • pnpm exec tsc --noEmit — clean
  • pnpm lint — clean
  • pnpm test:int — 95/95 passing
  • pnpm build — succeeds

🤖 Generated with Claude Code

Saving a media doc after using the image editor returned a 500 with a
generic "Something went wrong." in the admin.

The admin sends uploadEdits[crop] alongside the focal point, so Payload
regenerates the original file plus all image sizes and re-uploads them
under the same filenames. @payloadcms/storage-vercel-blob 3.86.0 calls
@vercel/blob's put() without allowOverwrite, which defaults to false in
v2, so every re-upload failed with "This blob already exists". This hit
production too, since prod also has a blob token.

Upstream fixed it in 3.87.0 by passing allowOverwrite: true, and 3.86.0
exposes no option to set it, so bump the whole Payload suite to 3.87.0 —
the adapter pins `payload` exactly as a peer dep, so a partial bump would
drift.

No migration needed: payload/dist/database and all of
@payloadcms/db-postgres/dist are byte-identical between 3.86.0 and
3.87.0. The payload-types.ts and importMap.js churn is regenerated
output (block interfaces hoisted, collections reordered) with no
interfaces added or removed.
@vercel

vercel Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
learning-platform Ignored Ignored Aug 6, 2026 3:52pm

@InnerDesires
InnerDesires merged commit b593516 into main Aug 14, 2026
5 of 10 checks passed
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.

1 participant