serverless-application-model
serverless-application-model copied to clipboard
Support Response Models For API Event Types
Hi team,
AWS::Serverless::Function
s provide a simple way to define API's and allow you to define RequestModels, which results in autogenerated Swagger so I was planing on using this feature for a new API I was building. However, I realized that you cannot define response models, and specifically error codes, which made this feature a non-starter for me. I'm opening this issue to request that SAM support response models in addition to request models so I don't have to end up authoring my own Swagger after all.
Hi
Im facing a similar/same issue where i define GatewayResponses but i cannot evaluate my lambda error response.
If my understanding is correct then i would like to do the following:
Proxy Lambda throws an error which then goes to API Gateway with Error Key: INTEGRATION_FAILURE. Here i would like to transform/catch that error object and transform/generalize it with VTL, but currently it seems to be not possible.
The lambda is a Proxy lambda (AWS::Serverless::Function) which have an event type: API (AWS:Serverless::API)
Documentation Link: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-gateway-responses.responseTemplates.html
EDIT The reason i want this behavior is to be able to raise and catch alarms from my lambda to send notification if an error happens, and also be able to return valid response at the same time
If there is a workaround please guide me to a correct place. Thank you in advance.
+1
+10
+1
+1