The lambda's request-routing logic in getOrCreateObject.js filters scaled-derivative requests by extension whitelist:
const sizeMatch = pathname.match(/-(\d+)x(\d+)\.(jpg|jpeg|png|gif)$/);
.webp is not included. Requests for image-300x200.webp don't match sizeMatch, fall through the "is this a render request" branch, and 404. The Sharp invocation itself is format-agnostic (no explicit .toFormat() is set, so output format follows input), so once routing matches .webp, end-to-end rendering works without further changes.
This would be an enabling change for the efforts around the Questrom site migration. That site's WordPress database already carries correct .webp size-suffix references, so this regex fix unblocks rendering for those assets.
Goals
- Add
webp to the sizeMatch regex in getOrCreateObject.js
- Add
webp to the originalPath reconstruction regex in the same file's NoSuchKey branch
- Delete the unused
getOriginalS3Key() function in resizeAndSave.js (carries a stale narrower regex (jpg|png); the path math is now done in getOrCreateObject.js)
- Add a WebP fixture to the test suite (sequence this first for test-driven development)
Acceptance criteria
- A request for a WebP scaled derivative whose original exists at original_media/... generates and serves the resized .webp correctly
- Existing jpg/jpeg/png/gif behavior unchanged
- WebP references in the Questrom WP database resolve end-to-end against a dev deployment
The lambda's request-routing logic in
getOrCreateObject.jsfilters scaled-derivative requests by extension whitelist:.webpis not included. Requests forimage-300x200.webpdon't matchsizeMatch, fall through the "is this a render request" branch, and 404. The Sharp invocation itself is format-agnostic (no explicit.toFormat()is set, so output format follows input), so once routing matches .webp, end-to-end rendering works without further changes.This would be an enabling change for the efforts around the Questrom site migration. That site's WordPress database already carries correct .webp size-suffix references, so this regex fix unblocks rendering for those assets.
Goals
webpto the sizeMatch regex in getOrCreateObject.jswebpto the originalPath reconstruction regex in the same file's NoSuchKey branchgetOriginalS3Key()function inresizeAndSave.js(carries a stale narrower regex (jpg|png); the path math is now done ingetOrCreateObject.js)Acceptance criteria