diff --git a/packages/gateway-common-http/src/common.ts b/packages/gateway-common-http/src/common.ts index 5d1c3ea8..64fba9d5 100644 --- a/packages/gateway-common-http/src/common.ts +++ b/packages/gateway-common-http/src/common.ts @@ -47,13 +47,14 @@ export async function parseInvokeOptionsByOriginUrl( Object.keys(functions).forEach((functionName) => { const functionItem = functions[functionName] || {}; const event = (functionItem.events || []).find((eventItem: any) => { - return eventItem.http; + return eventItem.http || eventItem.apigw; }); - if (event?.http) { + const eventItem = event?.http || event?.apigw; + if (eventItem) { urlMatchList.push({ functionName, - originRouter: event?.http?.path || '/*', - router: event?.http?.path?.replace(/\/\*$/, '/**') || '/**', + originRouter: eventItem.path || '/*', + router: eventItem.path?.replace(/\/\*$/, '/**') || '/**', }); } }); diff --git a/packages/gateway-common-http/test/fixtures/ice-demo-repo/f.yml b/packages/gateway-common-http/test/fixtures/ice-demo-repo/f.yml index 338ebe13..280499f7 100644 --- a/packages/gateway-common-http/test/fixtures/ice-demo-repo/f.yml +++ b/packages/gateway-common-http/test/fixtures/ice-demo-repo/f.yml @@ -17,7 +17,7 @@ functions: test3: handler: test3.handler events: - - http: + - apigw: path: /api/* test4: handler: test4.handler