I currently have an app that runs on a linux AWS EC2 instance, it uses pm2 to stay up/reboot. Upon boot the use of fileApi.uploadFile() works just fine and then I use documentApi.join() no problems. Sometime around a day later it errors out when trying to upload the file. If I restart the app, it will work again. There are no logs of the failed attempt to hit the API in my groupDocs dashboard. Here is a code snippet of my upload function call:
const uploadFiles = async (files, userID, callBack, res) => {
// construct FileApi
await Promise.all(
files.map(
async (file) =>
// read files one by one
await new Promise((resolve, reject) =>
fs.readFile(path.join(__dirname, `../Users/${userID}/${file.assetId}/${file.assetId}.pptx`),
async (err, fileStream) => {
if(err){
console.log(err)
} else {
// create upload file request
console.log("forming request");
let request = new groupdocs_merger_cloud.UploadFileRequest(
"/sutherlandTest/" + file.assetId + ".pptx",
fileStream,
myStorage
);
// upload file
console.log("request ", request);
try {
let response = await fileApi.uploadFile(request);
console.log(file.assetId + " file uploaded: " + response.uploaded.length);
} catch (error) {
throw error.message;
}
resolve()
}
}
)
)
)
);
await mergeSlides(files, userID)
};
Any tips would be helpful.