Home > database >  Too many time based triggers in Google Apps Script
Too many time based triggers in Google Apps Script

Time:11-30

I have a published add-on on the Google Workspace Marketplace. Suddenly users have started getting the error

This add-on has created too many time-based triggers in this document for this Google user account.

However, when I have the add-on log what triggers are installed, there are only three, and only one of them is time-based.

What I've started noticing, though, is in the master script file (the one I edit and then publish), when I look at triggers, there are a large number of triggers that are listed as being installed by "Other User." To be clear, there are no shared users on this spreadsheet or the script attached to it. Are these "Other User" triggers coming from users of the add-on?

Otherwise, I don't know what the above error would be referring to. But I also don't understand why the triggers for every user of the add-on would install in the master script.

I also went in and editing the code where the triggers are installed for each user to FIRST delete all instances of that trigger before installing it - same error.

I went a step further and made a button just to delete every single trigger - same error.

CodePudding user response:

From the documentation:

Each add-on can only have one trigger of each type, per user, per document. For instance, in a given spreadsheet, a given user can only have one edit trigger, although the user could also have a form-submit trigger or a time-driven trigger in the same spreadsheet. A different user with access to the same spreadsheet could have their own separate set of triggers.

You may want to create any triggers you need in the onInstall(e) function so that they only get created once. That way, you do not need to delete and recreate the triggers every time the add-on runs.

  • Related