Reputation: 305
I'm new to Lambda Computing and AWS. I'm trying to set up a REST API Service with Lambda. I have three different functions defined in my serverless.yml
file from my handler something like this:
functions:
users:
handler: handler.users
events:
- http:
path: users
method: get
cors: true
integration: lambda
stats:
handler: handler.Stats
events:
- http:
path: users/{id}/stats
method: get
cors: true
integration: lambda
contribution:
handler: handler.contribution
events:
- http:
path: patientset/{pid}/contribution
method: get
cors: true
integration: lambda
When I deploy the same, it throws me an error:
Serverless Error ---------------------------------------
An error occurred: ApiGatewayResourcePatientsetPidVar - A sibling ({id}) of this resource already has a variable path part -- only one is allowed (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: f4047858-b52d-4721-b0a2-069a59254e6b; Proxy: null).
So to test it, I change the path for the function contribution
from patientset/{pid}/contribution
to patientset/{id}/contribution
, the deployment is successful.
But this is what I don't require. I need to define the proper name convention for each function to help recognize what kind of id
a function is expecting as it's path parameter.
I also tried resolving the same with some suggestions around as found here, but this also didn't help. If anyone can help provide any solution for the same & this explains this weird behavior from serverless, highly appreciated.
Thanks in advance.
Upvotes: 0
Views: 2715
Reputation: 11
Seems to be a long standing AWS issue where changing the endpoint variable causes an issue
https://github.com/serverless/serverless/issues/3785
Upvotes: 1
Reputation: 427
Upvotes: 1