serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

Support Response Models For API Event Types

Open mlaff opened this issue 5 years ago • 5 comments

Hi team,

AWS::Serverless::Functions 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.

mlaff avatar Nov 14 '19 19:11 mlaff

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.

IstvanSzilagyi avatar Jan 08 '20 14:01 IstvanSzilagyi

+1

stevehogdahl avatar Dec 06 '21 17:12 stevehogdahl

+10

adamarla avatar Apr 04 '22 21:04 adamarla

+1

mh35 avatar Jun 16 '22 06:06 mh35

+1

ibegleris avatar Sep 06 '22 09:09 ibegleris