CURRENTLY
I have a 3MB image file that I would like to send to AWS Lambda (via API gateway) from Google Apps Script so the file can be processed.
My Lambda API Gateway Request:
let bytes = file.getBlob().getBytes();
console.log("Byte Size:"+bytes.length)
let payload = {
bytes: bytes,
type: "image",
};
var options = {
method: "PUT",
"Content-Type": "application/json",
payload: JSON.stringify(payload),
};
console.log("Stringified size:"+JSON.stringify(options))
var response = UrlFetchApp.fetch(
API,
options
);
ISSUE
The response I get is:
Byte Size:3308814
Stringified size: 11886033
Exception: Request failed for API returned code 413.
Truncated server response: HTTP content length exceeded 10485760 bytes.
QUESTION
What am I doing wrong such that the total package balloons from 3.3MB to over 10.4MB in my payload?