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

已提問 5 年前檢視次數 7721 次
5 個答案
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

專家
已回答 5 年前
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

專家
已回答 5 年前
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!!

已回答 5 年前
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.

已回答 3 年前
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.

已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南