diff --git a/ndc-lambda-sdk/src/execution.ts b/ndc-lambda-sdk/src/execution.ts index b0827a1..7ea78b8 100644 --- a/ndc-lambda-sdk/src/execution.ts +++ b/ndc-lambda-sdk/src/execution.ts @@ -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;