From 4f4f11d146f31951962db6abad956a59dfb261e0 Mon Sep 17 00:00:00 2001 From: Seb Aebischer Date: Thu, 28 Sep 2023 10:45:50 +0100 Subject: [PATCH] fix: Allow synchronous handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current type of `LambdaWrapper#wrap` requires handlers to return a `Promise`. We should support synchronous handlers too. No implementation change is required – they're already supported, just disallowed by the type system. Jira: [ENG-2732] --- src/core/LambdaWrapper.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/LambdaWrapper.ts b/src/core/LambdaWrapper.ts index 397a058..e7dece5 100644 --- a/src/core/LambdaWrapper.ts +++ b/src/core/LambdaWrapper.ts @@ -34,7 +34,10 @@ export default class LambdaWrapper(handler: (di: DependencyInjection) => Promise, options?: WrapOptions) { + wrap( + handler: (di: DependencyInjection) => T | Promise, + options?: WrapOptions, + ) { const { handleUncaughtErrors = true, } = options || {};