Error "413 Request entity too large" - sending file as param to apigateway.

0

Hey There,

I'am trying to send a file as a parameter to APiGateway and receiving error "413 Request Entity too Large". I am using VPC link in ApiGateway to connect to rest service. Here are the steps i have followed:

  1. Set the binaryMediaType on APi gateway - the values are "multipart/form-data" and "application/json".
  2. Added request header "Content-Type" to Method Request and Integration Request. Passing "Content-Type" : "multipart/form-data" from the client side.
  3. In integration request the "PassthroughBehavior": "WHEN_NO_MATCH"
  4. I want to pass the file as-is, no conversion to binary or text required. It is a json file.

Do I need to make any changes in API gateway? REST service returns the correct response if invoked directly.

Thanks!!

Edited by: nehasingh on Dec 31, 2018 8:34 AM

asked 5 years ago7553 views
5 Answers
1

Hello:

How big is the file you are sending? A 413 error code suggests you are exceeding a limit.

Please note that there is a 10MB payload limit for API Gateway requests to a REST API:

https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html

Regards,
Bob

EXPERT
answered 5 years ago
1

Can we send the file as multipart? or i will have to compress it?
This depends on what you mean by multipart; "multipart/form-data" does not actually split the file into multiple parts before uploading. Splitting the file manually into multiple parts and uploading is possible, but you'd be responsible for reassembly on the server side.

Regards,
Bob

EXPERT
answered 5 years ago
0

Hello @BobK,

Thanks for responding.

The file is almost 19 MB, i'am aware of the limitation on the payload size but i was hoping to send the payload as multipart. Can we send the file as multipart? or i will have to compress it?

Also, is it possible to pass file as a parameter to an apigateway which uses VPC link for integration(this link connects to rest service). All the examples that i came across in aws documentation are using S3 bucket or a Lambda for integration with the Apigateway when passing file as a parameter(multipart\form-data).

Please correct if I'am mistaken anywhere, I'am new to AWS.

Thanks!!

answered 5 years ago
0

How will the aws api gateway behave when a compressed payload of size less than 10mb limit passed to api gateway? Will it accept it? Suppose the uncompressed version of the payload is more than 10mb but the compressed version is less than 10mb, then when aws api gateway auto decompress it, will it reject the request stating "Error "413 Request entity too large".

Please help me in understaning this.

answered 3 years ago
0

How will the aws api gateway behave when a compressed payload of size less than 10mb limit passed to api gateway? Will it accept it? Suppose the uncompressed version of the payload is more than 10mb but the compressed version is less than 10mb, then when aws api gateway auto decompress it, will it reject the request stating "Error "413 Request entity too large".

Please help me in understaning this.

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions