0

I'm writing a Gmail extension with Google Apps Script. The extension uses the DriveApp class to save email attachments as Drive files.
The app worked just fine for the last few weeks. Yesterday, the following exception appeared:

Exception: We're sorry, a server error occurred. Please wait a bit and try again. [line: 10, function: getSubfolderByPath, file: FileMover]
Line 10 is: let curFolder = DriveApp.getFolderById(folderId);

The folderId variable is set correctly, I logged it and checked that the directory actually exists. I googled this obscure exception, and the only relevant info I found states that this might actually be an internal Google Drive problem, and that it might be related to some ongoing issue with the service. The app doesn't work for more then 24 hours, and I didn't find any notifications about ongoing issues.

4
  • If you can provide a little more of your code we might be able provide some assistance otherwise I agree it looks okay. Commented Apr 7, 2020 at 18:08
  • One line before this, I added a logging line: console.log(`Accessing folder: ${folderId} (type: ${typeof folderId})`); Output is: Accessing folder: ********************** (type: string) (Replaced actual ID with ***). Commented Apr 7, 2020 at 18:18
  • Server errors can be temporarily, but it also possible that e.g. the folder was shared with you before, but now you do not have access permission anymore or you are trying to access with ad different account (are you signed in with multiple accounts into your browser?). Commented Apr 8, 2020 at 7:25
  • 1. This is going for almost a week now. 2. I still have access to the directory. 3. Im know which Google account is used, because it is the one Im signed in to Gmail, right? Commented Apr 11, 2020 at 9:21

1 Answer 1

4

SOLVED!
Around the same time the problem appeared, I integrated the Google Apps Script project with my organisation's G Suite. When connecting the project to Google Cloud Platform, you are required to enable the specific Google APIs you are using.
After enabling the Google Drive API everything worked as before.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.