aws / aws/serverless-application-model
HTTP API duplicate integration
- Dominant language
- Python
- Stars
- 9.6k
- Forks
- 2.5k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 7
Description
### Description:
I want to use the same Lambda for 2 routes:
- /api/{id}
- /api/{id}/{proxy+}
I created 2 events in the same `Serverless::Function` definition.
The result is that it created 2 separate integrations with the same Lambda function.
### Steps to reproduce:
```yaml
ApiG:
Type: AWS::Serverless::HttpApi
Properties:
CorsConfiguration:
AllowHeaders: "*"
AllowMethods:
- GET
- POST
- DELETE
- HEAD
- PUT
- PATCH
AllowOrigins:
- '*'
EndpointConfiguration: REGIONAL
SecurityPolicy: TLS_1_2
StageName: api
ProxyServiceFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: proxy
CodeUri: proxy/src/
Handler: index.handler
Runtime: nodejs12.x
Events:
API1:
Type: HttpApi
Properties:
PayloadFormatVersion: "2.0"
Path: /api/{id}
Method: any
ApiId: !Ref ApiG
API2:
Type: HttpApi
Properties:
PayloadFormatVersion: "2.0"
Path: /api/{id}/{proxy+}
Method: any
ApiId: !Ref ApiG
```
### Observed result:
2 different integrations are created.
### Expected result:
1 integration is created and attached to the two routes.
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: Debian 10
2. If using SAM CLI, `sam --version`: 1.21.1
3. AWS region: eu-central-1
Contributor guide
Assessment
This issue has not been assessed yet.