serverless-step-functions
serverless-step-functions copied to clipboard
Handle Output Transformations
This is a Feature Proposal
Description
For feature proposals:
- What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
- If there is additional config how would it look
API Gateway allows users to modify the response body and headers based on content from the response from lambda, or the step functions. In the case of the step functions the output always appears to be:
{ "executionArn": "arn:aws:states:us-east-1:111111111111:execution:Name:ID", "startDate": epochTimeStamp }
I would like to be able to suppress this output and change the http response code to 201 or 204.
Thank you for the proposal @andrewhertog :+1: Sounds a good idea, but you cannot implement the feature since there is a restriction on AWS end. The output body is generated automatically on AWS side, so we are not really sure how to customize the response code.
We would love to get any feedback how to implement it :smile:
Perhaps you try like you did with IntegrationRequest? If I add this to the resources this seems to work
ApiGatewayMethodSubscriptionBrandVarPost:
Properties:
Integration:
IntegrationResponses:
- StatusCode: 200
SelectionPattern: '[1-5]\d\d'
ResponseTemplates:
application/json: '{"rules":[]}'
With ApiGatewayMethodSubscriptionBrandVarPost being defined als the stepfunction http event
@issuehuntfest has funded $20.00 to this issue. See it on IssueHunt
@horike37 @xonstone Has this gone anywhere? I need to modify the Integration Response as well.. had no luck so far figuring it out.
EDIT: okay, got it to work, LOL
ApiGatewayMethodVersionPost:
Type: AWS::ApiGateway::Method
Properties:
Integration:
IntegrationResponses:
- StatusCode: 200
ResponseTemplates:
application/json: '{"key":"value"}'
ResourceId:
Ref: ApiGatewayResourceVersion
RestApiId:
Ref: ApiGatewayRestApi