aws-lambda-ses-forwarder icon indicating copy to clipboard operation
aws-lambda-ses-forwarder copied to clipboard

TypeError: Cannot read property 'log' of undefined

Open rlauer6 opened this issue 7 years ago • 1 comments

I appear to get this error when there is no address found in the forward mapping object. Is that by design?

rlauer6 avatar Feb 11 '18 11:02 rlauer6

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.

benhell avatar Oct 05 '18 22:10 benhell