devcybiko / ses-catchall

14 stars 8 forks source link

"errorMessage": "Cannot read property '0' of undefined", #3

Closed tarun1982 closed 1 year ago

tarun1982 commented 1 year ago

https://github.com/devcybiko/ses-catchall#test-it -- When i am testing i am getting below error # Response { "errorType": "TypeError", "errorMessage": "Cannot read property '0' of undefined", "trace": [ "TypeError: Cannot read property '0' of undefined", " at Runtime.handler (/var/task/index.js:69:45)", " at Runtime.handleOnceNonStreaming (/var/runtime/Runtime.js:73:25)" ] }

Pls help me in fixing this issue.

devcybiko commented 1 year ago

it appears your code is getting called but not by SES. The line in question is

let sesMsg = JSON.parse(SNSEvent.Records[0].Sns.Message); log(JSON.stringify(sesMsg, null, 2));

the SNSEvent that is passed in appears to be empty. there is no 'Records' field which results in an error. My guess is your code was not invoked due to an SNS event