aws-lambda-ses-forwarder
aws-lambda-ses-forwarder copied to clipboard
TypeError: Cannot read property 'log' of undefined
I appear to get this error when there is no address found in the forward mapping object. Is that by design?
I think this is a change in behavior from v3 related to the introduction of Promises in v4.
In v4, when no recipients are matched, transformRecipients returns with "return data.callback()" which appears to then pass along a null value as the "data" argument to fetchMessage. fetchMessage then throws the undefined error when it first tries to access the "log" field of the "data" argument.
By contrast, in v3, it looks like there was an explicit "next" function rather than a Promise chain, and transformRecipients simply wouldn't call "next" if there were no message recipients. This effectively interrupted the execution chain and prevented any further handlers (starting with fetchMessage) from being called.