2

I recently started occasionally getting server errors from one of my scripts I set to run automatically every half hour. It doesn't happen consistently (sometimes with days between errors, other times just a few hours). It had been running without a hitch for nearly a year up until now, which is why I am surprised it would suddenly start spitting errors. When I checked the logs it says the error that occurred was "DEADLINE_EXCEEDED". I found other posts about similar errors, but none of the ones I found seemed to answer my question (and/or were resultant of problematic code). My code is really simple, so I don't see anything that could possibly be causing problems:

function markArchivedAsRead() {  
  var threads = GmailApp.search('is:unread -in:inbox -is:snoozed');
  GmailApp.markThreadsRead(threads);
  if (threads.length == 1) console.log("1 thread marked as read");
  else console.log(threads.length + " threads marked read");
}

Is this error something on Google's end?

Thanks!

Napostrophe
  • 145
  • 1
  • 6
  • Create a new issue in the issuetracker. See [tag info page](https://stackoverflow.com/tags/google-apps-script/info) for more details. – TheMaster May 13 '20 at 10:47

1 Answers1

1

These unexplained errors likely occur when you are using the V8 Runtime engine.

Open your appsscript.json file, change the runtimeVersion to DEPRECATED_ES5 and the errors should no longer happen.

Amit Agarwal
  • 10,910
  • 1
  • 32
  • 43