fix key value
This commit is contained in:
parent
35f168ffe0
commit
9124c10726
2
index.ts
2
index.ts
@ -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.");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user