-
Notifications
You must be signed in to change notification settings - Fork 562
Open
Labels
Description
Describe the bug
I'm using Dynamic Image Transformation for Amazon CloudFront. Version v7.0.6 with s3 object lambda and auto webp enabled. When attempt to get svg image from cloudfront I'm getting 500 error "Internal error. Please contact the system administrator.".
Here is my decoded request payload
{"bucket":"my-bucket","key":"attachments/bd3bd61f-1ffd-4738-9fdd-1fce6bb9337e","headers":{"Cache-Control":"max-age=31536000,public"}}
Here is full lambda error log
ERROR TypeError: Cannot read properties of undefined (reading 'toFormat')
at _ImageRequest.setup (/var/task/index.js:46047:96)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleRequest (/var/task/index.js:47165:30)
at async Runtime.handler (/var/task/index.js:47132:25)
I also logged the imageRequestInfo.
INFO {
secondsToExpiry: undefined,
requestType: 'Default',
bucket: 'my-bucket',
key: 'attachments/bd3bd61f-1ffd-4738-9fdd-1fce6bb9337e',
edits: undefined,
contentType: 'image/svg+xml',
lastModified: 'Tue, 08 Jul 2025 06:28:03 GMT',
cacheControl: 'max-age=31536000,public',
originalImage: <Buffer 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f 3e 0a 3c 73 76 67 20 69 64 3d 22 5f eb ... 3596 more bytes>
}
Looks like if there is no edits field in request, accessing imageRequestInfo.edits.toFormat without first checking if imageRequestInfo.edits exists throws error
Maybe same issue with #364