I was using this code for some time in Google Script and it stopped working several weeks ago. Trying to get the code back up but can't seem to figure it out.
The error message I get is :
Exception: Unexpected error while getting the method or property insert on object Apiary.drive.files. (line 125, file "Code")
Line 125 is the line:
var gdocFile = Drive.Files.insert(resource, pdfFile, insertOpts).id;
// Save PDF as GDOC
resource.title = pdfName.replace(/.pdf$/, '');
var insertOpts = {
ocr: true,
ocrLanguage: options.ocrLanguage || 'en',
uploadType: 'multipart'
};
var gdocFile = Drive.Files.insert(resource, pdfFile, insertOpts).id;
//Get text from GDOC
var gdocDoc = DocumentApp.openById(gdocFile);
var text = gdocDoc.getBody().getText();