Skip to content

Commit 34b2dac

Browse files
committed
fix(BaseHandler): ensure function scope
1 parent c561a7a commit 34b2dac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/handler/BaseHandler.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ export abstract class BaseHandler {
103103
const handler = this;
104104
return async function fn(event: Event, context: Context): Promise<unknown> {
105105
try {
106-
return handler.after(await method.apply(handler, handler.before(event, context)));
106+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
107+
// @ts-ignore
108+
// eslint-disable-next-line @typescript-eslint/no-this-alias
109+
const instance = this;
110+
return handler.after(await method.apply(instance, handler.before(event, context)));
107111
} catch (err) {
108112
return handler.onException(err);
109113
}

0 commit comments

Comments
 (0)