Ciao, I am using convertapi to merge pdfs in a Google App Script ( pdfs are created from email attachment received from customers of ours ).
The code is
BLA BLA BLA BLA
while (files.hasNext()) {
var file = files.next();
formData['Files[' + index + ']'] = file.getBlob();
index++;
}
var options = {
'method': 'post',
'payload': formData,
'muteHttpExceptions': true
};
var response = UrlFetchApp.fetch('https://v2.convertapi.com/pdf/to/merge?Secret=MIOCODICE', options);
My problem is that this code works 95% of the times. Sometimes I receive an error code 500 with no additional explanation.
EDIT: when I get the error code che response is "Oops! Sorry! Something went wrong. We have been notified about the problem and we will try to fix". Not really helpful.
Error is triggered always from the same customers so the error is connected to the type of pdf they send me. The pdf which triggers an error seems fine, I have no problem in downloading/printing/viewing it.
EDIT: is not a network/temporary problem because I always have this merging problem with the same pdfs, no matter how many times I re-try.
The strange thing is that the files are correctly merged via web convertapi interface ( https://www.convertapi.com/pdf-to-merge ) but still, no way to have them merged via script.
Any suggestion on how to fix this strange behaviour?