Reputation: 46423
I have read similar questions such as Error type of "We're sorry, a server error occurred. Please wait a bit and try again. " and many others, but they were specific to other types of error.
I have a Google Apps Script running and processing Gmail emails with a minute timer.
Each day I receive logs by email with We're sorry, a server error occurred. Please wait a bit and try again.
(see screenshot #1 below). The problem is that:
there is no report of the line where the error happened, so it's hard to debug
it happens randomly every now and then, even if nothing happened at this precise time (there was no email to process), and 99.9% of the time, everything works without error. When there is no email to process, I can't see why this code can fail:
var mylabel = GmailApp.getUserLabelByName('emailstoprocess');
var threads = mylabel.getThreads();
for (var i = 0; i < threads.length; i++) {
// do something
}
in my scripts I don't call any external API, only Gmail API, and no time-consuming loop (especially when no new email is there: the script should do nothing). How can I have control over this DEADLINE_EXCEEDED
error (see screenshot #2 below)? Indeed in the dashboard, Executions
page, I see: We're sorry, a server error occurred: DEADLINE_EXCEEDED
.
How to avoid this DEADLINE_EXCEEDED
error even if my script had did nothing at the time of the failure?
Or at least how to avoid receiving notifications each day about this?
Upvotes: 6
Views: 3740
Reputation: 1728
As I can see this a specific error which occurs when you are using the V8 Runtime. Given the information provided you can avoid these errors by using Rhino Runtime. This is not the ideal workaround but there's not more information to debug.
Edit your manifest file appscript.json
(if you are using the new script editor go to Project Settings > mark Show "appsscript.json" manifest file in editor) and change the runtimeVersion to STABLE or DEPRECATED_ES5 which means "change it to Rhino".
In this case it's probably an issue in Google Apps Scripts and you should post it on the Google Issue Tracker as recommended.
Upvotes: -1