Exception: Service error: Drive suddenly started happening for Google Drive makeCopy

1,882 views
Skip to first unread message

Shaun M

unread,
Feb 24, 2021, 4:15:23 AM2/24/21
to Google Apps Script Community
I have a super-simple script that has been working fine for a few months - getting a file by its ID, then copying a version of it to a folder with the date in the new file name:

  var date = Utilities.formatDate(new Date(), "GMT""yyyy-MM-dd");  
  var file DriveApp.getFileById("[--TheIdOfTheFileIsHere--]");
  var folder DriveApp.getFolderById("[--TheIdOfTheFolderIsHere--]");
  var newFile file.makeCopy(date+' File'folder);

A week or two ago it started erroring on every run with the message "Exception: Service error: Drive".

Any idea what it could be? The script hasn't been touched so I thought maybe permissions could have been changed on the file or folder - but even setting them to be least restrictive doesn't help. Has something changed with DriveApp?

Thanks!

Andrew Roberts

unread,
Feb 24, 2021, 6:05:57 AM2/24/21
to google-apps-sc...@googlegroups.com
Which line are you actually getting the error on.

I noticed the same thing on a domain account for the last few days on DriveApp.getFolderById(). I've tried various combinations of user accounts and sharing, but not been able to get around it yet.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/5b08b515-c4cd-4143-84c1-6a26d92ba12ao%40googlegroups.com.

Andrew Roberts

unread,
Feb 24, 2021, 6:15:53 AM2/24/21
to google-apps-sc...@googlegroups.com
Well that's a nasty one!

It looks like since Feb 12th if you have a GCP associated with the project you have to enable the Drive API as both an advanced service and in the console. Fixed it for me.

Shaun Millis

unread,
Feb 25, 2021, 2:36:50 AM2/25/21
to Google Apps Script Community
Thanks for the tip! Unfortunately didn't seem to help with me. I already had the advanced service enabled - I've now created a separate GCP with the Drive API enabled and associated it. I can see the calls going through to the logging there - the drive.files.get are all 0% errors but the drive.files.copy are all 100% errors

I'm not sure if it makes any difference but its version is shown as V2beta. I looked to see if changing it would help - but the config of the service in AppsScript only has 'v2' selectable so not sure if that's something possible to change?
Reply all
Reply to author
Forward
0 new messages