Reputation: 77
I have been trying to create a Google Apps Script which sets a trigger before time-out and continues after a set period of time.
The first trigger works properly, but the second trigger always fails to execute the code, with this error message "This trigger has been disabled for an unknown reason."
I stripped back the code to test this with the following:
function setTriggerTest() {
var triggers = ScriptApp.getProjectTriggers();
for ( var i in triggers ) {
//delete all previous triggers for this function
if (triggers[i].getHandlerFunction() == "setTriggerTest") {
ScriptApp.deleteTrigger(triggers[i])
}
}
var currTime = (new Date()).getTime();
//set a new trigger to launch this function in 10000 milliseconds
ScriptApp.newTrigger("setTriggerTest")
.timeBased()
.at(new Date(currTime+10000))
.create();
}
This code runs, then successfully sets up the next trigger, then runs the setTriggerTest() function again, then sets up another trigger. But then that second trigger fails to execute setTriggerTest(), with the error message "This trigger has been disabled for an unknown reason."
Is there any reason behind this and/or workaround? Basically I want to perform functions that take 15 minutes altogether so it needs to be split over three executions.
Upvotes: 3
Views: 1681
Reputation: 321
Noting that this is still unresolved (as are those four issues listed in the answer above from the IssueTracker) 18 months later (March 2022).
Upvotes: 0
Reputation: 50880
This is a known issue and has been reported multiple times in the issue tracker. Consider adding a star(on top left) to these issues to let Google know you want them to prioritize the issue. For some, Reverting back to old rhino engine has resolved the issue.
Upvotes: 4