Skip to main content
Feedback

Design and Implementation

Sidecar Connector Sequence Flow Diagram

ref1

Sidecar Connector System Architecture Flow Diagram

ref1

Sidecar Integration Error Handling

Error NameError MessageHTTP Status CodeCause
InvalidPreInputConfigurationAWS Region Not Specified500AWS region not specified in pre-input configuration
InvalidPreInputConfigurationFunction ARN Not Specified500Function ARN not specified in pre-input configuration
InvalidPreInputConfigurationRole ARN Not Specified500Role ARN not specified in pre-input configuration
InvalidPreInputConfigurationExternal ID Not Specified500External ID not specified in pre-input configuration
InvalidPreInputConfigurationSidecar Connector timeout is greater than endpoint timeout500Sum of timeout specified in pre and post input configuration is more than endpoint timeout.
RequiredHeaderConditionFailureRequired Header - <Header Name> Unavailable400One of the require-request-headers defined in pre-input configuration is not present in the request sent to API Management.
RequiredHeaderConditionFailureHeader Information Unavailable400Unable to fetch information about request headers sent to API Management
RequiredApplicationEAVConditionFailureRequired Application EAV - <Application EAV Name> Unavailable400One of the require-eavs defined in pre-input configuration is not present in the request sent to API Management. EAV could be missing as it's not defined in Control Center for application through which request is sent to API Management.
RequiredApplicationEAVConditionFailureError occurred while fetching application data400Unable to fetch information about Application EAVs
RequiredPackageKeyEAVConditionFailureRequired Package Key EAV - <Package Key Name> Unavailable400One of the require-packageKey-eavs defined in pre-input configuration is not present in the request sent to API Management. EAV could be missing as its not defined in Control Center for package key through which request is sent to API Management.
RequiredPackageKeyEAVConditionFailureError occurred while fetching package key data400Unable to fetch information about Package Key EAVs
MaxPayloadConditionFailurePayload length is more than max allowed payload413If max-payload-condition is defined as "blocking" and size of the payload which needs to be sent to AWS Lambda (either request payload or response payload) is greater than defined max-payload-size in pre-input configuration.
MaxPayloadConditionFailurePayload length is more than 1MB.413If size of the payload which needs to be sent to AWS Lambda (either request payload or response payload) is greater than 1MB.
InvalidJSONInputForAWSLambdaError while creating json input for AWS Lambda in pre-process400AWS Lambda Request which will be sent from API Management to AWS Lambda in pre-process is not created in proper JSON format.
InvalidJSONInputForAWSLambdaError while creating json input for AWS Lambda in post-process500AWS Lambda Request which will be sent from API Management to AWS Lambda in post-process is not created in proper json format.
InvalidResponseFromAWSLambdaInPreProcessAWS Lambda Response is not returned500Response is not returned from AWS Lambda function in pre-process. In case failSafe is defined as "true", even if response is not returned from AWS Lambda function, error will not be thrown.
InvalidResponseFromAWSLambdaInPostProcessAWS Lambda Response is not returned500Response is not returned from AWS Lambda function in post-process. In case failSafe is defined as "true", even if response is not returned from AWS Lambda function, error will not be thrown.
InvalidResponseFromAWSLambdaInPostProcessInvalid output from AWS Lambda function500Response returned from AWS Lambda in post-process is not in proper JSON format.
InvalidResponseFromAWSLambdaInPreProcessInvalid output from AWS Lambda function500Response returned from AWS Lambda in pre-process is not in proper JSON format.
InvalidResponseFromAWSLambdaInPreProcessSuccess Response not returned from AWS Lambda500AWS Lambda response status code is other than 200 and 202 in pre-process
InvalidResponseFromAWSLambdaInPreProcessError while connecting to AWS lambda.500Exception occurred while connecting to AWS Lambda in pre-process
InvalidResponseFromAWSLambdaInPreProcess<Exception Message From AWS Lambda>500Amazon Service Exception occurred while connecting to AWS Lambda in pre-process.
InvalidResponseFromAWSLambdaInPostProcessSuccess Response not returned from AWS Lambda500AWS Lambda response status code is other than 200 and 202 in post-process
InvalidResponseFromAWSLambdaInPostProcessError while connecting to AWS lambda.500Exception occurred while connecting to AWS Lambda in post-process
InvalidResponseFromAWSLambdaInPostProcess<Exception Message From AWS Lambda>500Amazon Service Exception occurred while connecting to AWS Lambda in post-process.
Gateway TimeoutTimeout occured while connecting to AWS Service504Timeout occurred while connecting and retrieving response from Lambda function.

AWS Lambda Function Error Handling

Unlike Lambda Function invocation errors, function errors don't cause Lambda to return a 400-series or 500-series status code.

If the function returns an error, Lambda indicates this by including a header named X-Amz-Function-Error, and a JSON-formatted response with the error message and other details. Make a note Lambda function runtime errors still comes with HTTP status code as 2xx.

Lambda runtime errors are formatted like errors that implementor code returns, but they are returned by the runtime. In the following example, the Lambda runtime fails to deserialize the event into an object and responds with error message, cause and other details.


{
"errorMessage": "An error occurred during JSON parsing",
"errorType": "java.lang.RuntimeException",
"stackTrace": [],
"cause": {
"errorMessage": "com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not construct
instance of java.lang.Integer from String value '1000,10': not a valid Integer value\n at [Source:
lambdainternal.util.NativeMemoryAsInputStream@35fc6dc4; line: 1, column: 1] (through reference
chain: java.lang.Object[0])",
"errorType": "java.io.UncheckedIOException",
"stackTrace": [],
"cause": {
"errorMessage": "Can not construct instance of java.lang.Integer from String value '1000,10': not
a valid Integer value\n at [Source: lambdainternal.util.NativeMemoryAsInputStream@35fc6dc4;
line: 1, column: 1] (through reference chain: java.lang.Object[0])",
"errorType": "com.fasterxml.jackson.databind.exc.InvalidFormatException",
"stackTrace": [
"com.fasterxml.jackson.databind.exc.InvalidFormatException.from
(InvalidFormatException.java:55)",
"com.fasterxml.jackson.databind.DeserializationContext.weirdStringException
(DeserializationContext.java:907)",
...
]
}
}
}

In this case, Sidecar Connector rejects the call and respond to user client with an error message in the format described below. HTTP Status Code is set as 502 in case of function error from AWS Lambda and below message is set as HTTP Response Body. Below message format provides enough details to the user client for the cause but not the entire stack trace. This error response body design is closer in compliance to RFC 7807: Problem Details for HTTP APIs as well as AWS Lambda guidelines.

{
"code": 502,
"message": {
"detail": "An error occurred during JSON parsing",
"title": "java.lang.RuntimeException"
}
}
On this Page