Description
Hi Team,
When integrating AWS Lambda with WSO2 API Manager, inconsistent HTTP response behavior is observed depending on the Lambda integration method.
When using a Lambda Function URL (HTTP endpoint), the backend returns the correct HTTP status (e.g., 404), and WSO2 APIM forwards it correctly to the client.
However, when invoking Lambda via AWS endpoint (ARN-based invocation), AWS returns HTTP 200 at the transport level, while the actual status code (e.g., 404) is included in the response payload.
In this case, WSO2 APIM forwards HTTP 200 to the client without interpreting the statusCode field in the payload.
Ideally, WSO2 APIM should return the correct HTTP status code (e.g., 404) to the client, regardless of the Lambda integration type.
According to AWS documentation, Lambda integrations return HTTP 200 by default unless error mapping is configured at the API Gateway level:
[1] https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
Steps to Reproduce
- Create a sample AWS Lambda function:
def lambda_handler(event, context):
return {
"statusCode": 404,
"headers": {"Content-Type": "application/json"},
"body": '{"message": "Resource not found"}'
}
-
Configure Lambda using Function URL (HTTP backend):
-
Invoke via WSO2 APIM
-
Observe: HTTP 404 is correctly returned
-
Configure Lambda using AWS endpoint (ARN-based invocation):
-
Invoke via WSO2 APIM
-
Observe: HTTP 200 OK is returned
Actual response:
{
"statusCode": 404,
"headers": {"Content-Type": "application/json"},
"body": "{\"message\": \"Resource not found\"}"
}
Version
wso2am-4.6.0
Environment Details (with versions)
No response
Description
Hi Team,
When integrating AWS Lambda with WSO2 API Manager, inconsistent HTTP response behavior is observed depending on the Lambda integration method.
When using a Lambda Function URL (HTTP endpoint), the backend returns the correct HTTP status (e.g., 404), and WSO2 APIM forwards it correctly to the client.
However, when invoking Lambda via AWS endpoint (ARN-based invocation), AWS returns HTTP 200 at the transport level, while the actual status code (e.g., 404) is included in the response payload.
In this case, WSO2 APIM forwards HTTP 200 to the client without interpreting the statusCode field in the payload.
Ideally, WSO2 APIM should return the correct HTTP status code (e.g., 404) to the client, regardless of the Lambda integration type.
According to AWS documentation, Lambda integrations return HTTP 200 by default unless error mapping is configured at the API Gateway level:
[1] https://docs.aws.amazon.com/apigateway/latest/developerguide/handle-errors-in-lambda-integration.html
Steps to Reproduce
Configure Lambda using Function URL (HTTP backend):
Invoke via WSO2 APIM
Observe: HTTP 404 is correctly returned
Configure Lambda using AWS endpoint (ARN-based invocation):
Invoke via WSO2 APIM
Observe: HTTP 200 OK is returned
Actual response:
Version
wso2am-4.6.0
Environment Details (with versions)
No response