From 20c4eee9a4764997e775ad5327b0f7cae3021909 Mon Sep 17 00:00:00 2001 From: Dylan Wright Date: Wed, 24 Apr 2024 11:43:34 +0100 Subject: [PATCH] Fixing record loop --- index.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.mjs b/index.mjs index c08859f..1af473d 100644 --- a/index.mjs +++ b/index.mjs @@ -86,9 +86,9 @@ const updateElasticIndex = async (contentfulEntry, action) => { } }; -export const handler = async (records) => { - console.log('Records: ', records); - for (record of records) { +export const handler = async (data) => { + console.log('Data: ', data); + for (const record of data.Records) { console.log('Message Recieved: ', message); if (!record.body || !record.body.contentfulEntryId || !record.body.type) throw new Error(`Invalid Message: ${record.body}`);