I am using node js to get the HTTPS response from the server . The response contains more than 6291556 bytes When I execute this function I got the below exception. Is there any best way to handle the error
{
"errorMessage": "Response payload size exceeded the maximum allowed payload size (6291556 bytes).",
"errorType": "Function.ResponseSizeTooLarge"
}
Sample code
var res = await beResult(event.id);
const response = {
statusCode: 200,
body: res,
};
return response;
};
async function beResult(id) {
const url = "https://api.com/request/";
const params = {
method: "GET",
mode: "cors",
headers: {
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
"Content-Type": "application/json",
}
};
const urlId= url + id;
return await fetch(urlId, params).then(res => res.json())
.then(json => { return json;});
}