I’ve tried to create a custom resource with API GW and method. Perhaps I’m wrong, but that would create it’s own API gateway endpoint? I would end up with two API endpoints. One via serverless and another via the custom resource.
The Serverless Framework basically transforms your serverless.yml into a CloudFormation template. You can override and extend the template it outputs through the resources section in your serverless.yml. Just make sure you adding it to the API GW created by Serverless and you’re not creating a new one.
As you said above. I have created custom API Gateway resource and method .
- ApiGatewayRestApi # our default Rest API logical ID
PathPart: healthcheck # the endpoint in your API that is set as proxy
HttpMethod: GET # the method of your proxy. Is it GET or POST or ... ?
- StatusCode: 200
- StatusCode: 200```
it gives an error.
An error occurred: ProxyResource - Another resource with the same parent already has this name: healthcheck (Service: AmazonApiGateway; Status Code: 409; Error Code: ConflictException; Request ID: 1ddbceb6-a405-4930-9962-dfaf4b376664).
Is it still the case that you cannot connect to an api gateway created outside of your cloud formation template via your serverless.yml file? My lambda function needs to get triggered from the api gateway. This API gateway is not created as part of my serverless stack. The api gateway is set up already and integrated with cognito and my serverless.yml needs to create a lambda function that gets triggered by that existing api gateway. Is this not possible?
So far I have only found the solution where I need to create api gateway via serverless.yml then import it in another serverless.yml as a resource. Unfortunately, how this api gateway gets created is not upto me and my lambda has to get triggered from that existing API gateway. Please do let me know if anyone has solved this or there is no solution for this yet.