-
Notifications
You must be signed in to change notification settings - Fork 16
RequestTooLargeException vs RequestEntityTooLargeException #45
Comments
Thanks for reaching out @erjiang. It looks like the The best way to workaround this issue is to define a constant in your application to compare against the With that said, Creating a post on the AWS Lambda forums letting them known about the issue would be helpful. |
Do you have example code that is receiving this error message? This will help investigate this issue with the Lambda service team. The |
I did find the RequestEntityTooLargeException defined in the IoT files, but my code only touches lambda. Here's my code: // in init function:
client = lambda.New(sess, &aws.Config{Region: aws.String("us-east-1")})
// aws go sdk lambda: https://docs.aws.amazon.com/sdk-for-go/api/service/lambda/
result, err := client.Invoke(&lambda.InvokeInput{FunctionName: aws.String(lambdaName), Payload: payload, LogType: aws.String("Tail")})
if err != nil {
awsErr, ok := err.(awserr.Error)
// this exception is triggered if user uploads a large file.
// TODO: don't bother sending the request to lambda if it's too big? And
// figure out an alternate way to do file uploads.
if ok && (awsErr.Code() == "RequestEntityTooLargeException" || awsErr.Code() == "RequestTooLargeException") {
w.WriteHeader(413)
fmt.Fprintf(w, "Error 413: Upload too large")
} else {
w.WriteHeader(502)
fmt.Fprintf(w, "Error 502: There was an error processing this request")
}
log.Println("Error invoking lambda function")
log.Println(err)
return
} as you can see I ended up just matching on strings, and also threw in a check against "RequestTooLargeException" in case the API changes. |
P70312107 |
Contacted service team for an update. Awaiting response. |
Followed with service team again. |
Contacted service team for an update. Awaiting response. |
We have opened product feature request with the service team. As of now, we do not have ETA on when this would be implemented. It should be reviewed by service team along with other priority items. Since no action is required from our side (SDK), closing this issue. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Please fill out the sections below to help us address your issue.
Version of AWS SDK for Go?
1.27.4
Version of Go (
go version
)?1.13.5
What issue did you see?
I tried to filter errors coming from Invoke for "RequestTooLargeException" but I actually got the error "RequestEntityTooLarge" exception:
2020/01/15 14:51:45 Error invoking lambda function 2020/01/15 14:51:45 RequestEntityTooLargeException: Request must be smaller than 6291456 bytes for the InvokeFunction operation status code: 413, request id: 4f90b35e-c583-4c6e-bccb-9956291dd896
My error handling code looked like:
The SDK defines lambda.ErrCodeRequestTooLargeException, but not lambda.ErrCodeRequestEntityTooLargeException. So, am I looking in the wrong place for the error code constant? What's the difference between RequestTooLargeException and RequestEntityTooLargeException? (The descriptions seem to describe the same thing.)
Workaround was just to use a string instead of referencing a constant from the package.
The text was updated successfully, but these errors were encountered: