Conversation
|
I think this patch would necessitate people who use the 8.10 runtime to write their handlers as promises, which they might not be doing. Instead of checking for the callback (which I believe can be injected independently of the handler type), would it make sense to just check if the handler is a promise? I think the version may not even be relevant in that case. I'm very much interested in having support for async/await in this library also. |
it's not true. see |
|
That line checks whether the callback parameter was provided to the lambda function, not whether the lambda function responds to a callback parameter. If I implemented my lambda function as exports.handler = (event, context, callback) => {
callback(null);
}then invoked it with wrapped.run(event)this would pass the Likewise, if my lambda function was implemented as exports.handler = async (event) => {
return true;
}and invoked using wrapped.run(event, context, callback)this would fail the Additionally, checking the current version against a string is fragile. Someone whose local environment is running node 8.11 for whatever reason would not be supported by this change. My earlier suggestion (which was worded obliquely) was to remove the check for the version number and instead check whether the lambda is a Promise, which can be done by checking whether |
|
Your explanation doesn't make sense for me because of two reasons:
that's true, that's why this pull request just a suggestion or demo, at least I hope it wont be merged as is. btw I have updated verification with regex |
|
closed because of #22 |
Just a suggestion of how to fix. No tests etc.
see #20