Skip to content

Commit

Permalink
Fix promise check for null values
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljharvey committed Apr 15, 2024
1 parent 089e447 commit 8873625
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ndc-lambda-sdk/src/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function invokeFunction(func: Function, preparedArgs: unknown[], functionN
return await withActiveSpan(tracer, `Function: ${functionName}`, async () => {
const result = func.apply(undefined, preparedArgs);
// Await the result if it is a promise
if (typeof result === "object" && 'then' in result && typeof result.then === "function") {
if (result && typeof result === "object" && 'then' in result && typeof result.then === "function") {
return await result;
}
return result;
Expand Down

0 comments on commit 8873625

Please sign in to comment.