aws-cli-tools / chaos-lambda-extension

The lambda-chaos-extension allows you to inject faults into Lambda functions without modifying the function code.
Apache License 2.0
27 stars 0 forks source link

Feature Request: Modify Response Prior to Lambda Handler Invocation #11

Open andrestoll opened 7 months ago

andrestoll commented 7 months ago

Motivation: In the current implementation of the chaos-lambda-extension, the Lambda function handler is invoked before any modifications are made to the response. For certain use cases, particularly in testing and chaos engineering scenarios, having the ability to modify the response before the Lambda handler is invoked can provide more flexibility and control.

Detailed Description: I propose a feature that allows the chaos-lambda-extension to modify the response prior to invoking the Lambda function handler. This feature would enable users to inject faults or modify the response in a way that the Lambda function can immediately react to, allowing for more comprehensive testing and resilience checks.

Use Cases:

Potential Challenges:

Alternatives Considered: Option to do it before or after., through env variable

having-fun-serverless commented 7 months ago

@andrestoll just to make sure that I follow, do you want to change the response or the request, right now you do have the ability to inject your own response, check https://github.com/aws-cli-tools/chaos-lambda-extension#response-fault

andrestoll commented 7 months ago

I would like to have the possibility to post (an error) response before invoking the function handler.

The reason being is you might want to respond with HTTP code 500. But you're function completes successfully.