Hi Team,
Below i try to get attachement from deal, after converting it to Buffer format i am sending the data to frontend while transfering it throws the following error.
Error while executing App server script!
Note: file size is 1.8 MB
server.js:
uploadFromS3File: async function (options) {
try {
let docId = options.url.split('.com')[1]
console.log("DOCUMENT URL: ", options.iparams.freshSalesUrl+"/crm/sales"+docId )
var freshsalesOptions = {
url: "https://"+options.iparams.freshSalesUrl+"/crm/sales"+docId,
method: "GET",
headers: {
Authorization: "Token token=" + options.iparams.freshsalesTokenValue,
Accept:"*/*"
},
encoding: null
};
await request(freshsalesOptions, (err, res, body) => {
console.log("S3 File res: ",JSON.stringify(res), " Body: ", JSON.stringify(body));
renderData(null, { s3FileStatus: 200, response: body });
})
} catch (err) {
const responseJson = { status: "error", message:err.message };
console.log("Error in fetching S3 File:", err ? `${err.response ? JSON.stringify(err.response) : null} : ${err.message || null}` : null);
renderData(null, { s3FileStatus: 400, response: responseJson });
}
},```
model.js
async function invokeUpload(options) {
return await data.request.invoke("uploadFromS3File", options).then(function (data) {
console.log("uploadFromS3File response", data);
return data
}).catch( function(err){
console.log("Error In uploadFromS3File", err);
invokeDealPayload(`Error In uploadFromS3File: ${(JSON.stringify(err))}`,`Deal ID : ${dealDataValue['DealID']}`,` Error Remarks`);
return null
});