Repository navigation
fix: allow saving media after a focal point change - #96
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 a500: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.0calls@vercel/blob'sput()withoutallowOverwrite, and that defaults tofalsein@vercel/blobv2 — so every re-upload was rejected.This affected production as well, since prod also has
BLOB_READ_WRITE_TOKENset.Fix
Upstream fixed this in
3.87.0by passingallowOverwrite: trueinuploadFile.ts. Version3.86.0exposes no config option to set it, so the whole Payload suite is bumped3.86.0 → 3.87.0— the storage adapter pinspayloadexactly as a peer dependency, so a partial bump would drift.src/payload-types.tsandsrc/app/(payload)/admin/importMap.jsare regenerated output. The type churn is purely structural (MediaBlock/ArchiveBlockhoisted from inline definitions to named interfaces,payload-mcp-api-keysreordered) — 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-identicalVerification
500before the fix, in the real admin UI.200, and re-reading/api/media/5confirmsfocalX/focalYpersisted65/20 → 25/80with sizes regenerated under the same filenames.201, 7 sizes generated), and a focal edit on that new doc also returns200.pnpm exec tsc --noEmit— cleanpnpm lint— cleanpnpm test:int— 95/95 passingpnpm build— succeeds🤖 Generated with Claude Code