fix key value

This commit is contained in:
Nimer Farahty 2025-04-20 00:30:46 +03:00
parent 35f168ffe0
commit 9124c10726

View File

@ -25,8 +25,8 @@ async function start() {
const data = JSON.parse(msg.content.toString());
eventName = data.Records?.[0]?.eventName;
key = decodeURIComponent(data.Records?.[0]?.s3?.object?.key || "");
bucket = data.Records?.[0]?.s3?.bucket?.name;
key = (data.Key as string).replace(bucket ?? "", "");
if (!eventName || !bucket || !key) {
throw new Error("Missing required event fields.");