We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9696f25 commit 765d972Copy full SHA for 765d972
packages/dd-trace/src/lambda/handler.js
@@ -86,10 +86,13 @@ exports.datadog = function datadog (lambdaHandler) {
86
const context = extractContext(args)
87
88
checkTimeout(context)
89
- if (lambdaHandler.constructor.name === 'AsyncFunction') {
90
- return Promise.resolve(lambdaHandler.apply(this, args))
91
- .then((res) => { clearTimeout(__lambdaTimeout); return res })
+ const result = lambdaHandler.apply(this, args)
+ if (result && typeof result.then === 'function') {
+ return result.then((res) => {
92
+ clearTimeout(__lambdaTimeout)
93
+ return res
94
+ })
95
}
- return lambdaHandler.apply(this, args)
96
+ return result
97
98
0 commit comments