Skip to content

Commit 26a59e5

Browse files
committed
fix(handler-aws): check for canHandle existence
1 parent 32f6b34 commit 26a59e5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/handler-aws/src/raw/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ export const createHandler = <Payload = any, Response = APIGatewayProxyResult>(
5555
const plugins = app.webiny.plugins
5656
.byType<RawEventHandler<Payload, any, Response>>(RawEventHandler.type)
5757
.filter(plugin => {
58+
/**
59+
* Just in case check that the plugin contains canHandle method.
60+
* If it does not, we assume it can handle any payload.
61+
*/
62+
if (typeof plugin.canHandle !== "function") {
63+
return true;
64+
}
5865
return plugin.canHandle(payload);
5966
})
6067
.reverse();

0 commit comments

Comments
 (0)