How G Suite add-ons updated after we published new versions?

25 views
Skip to first unread message

Hoang Trinh

unread,
Oct 19, 2019, 4:43:36 AM10/19/19
to Google Apps Script Community

Hi everyone,

Recently, I published a new add-on version which has a 1 hour time-based trigger that will add some new fields in my database collection

It's 3 days up until now, but when I checked my database collection, there are still many users who do not have new fields that I added, which means the add-on is not updated for them, because if the add-on is updated, the time-based trigger must be fired already.

I did some tests with my accounts, and I saw that if I open the add-on after the new version is published *at least once*, about 20-30 minutes later I will have the new version updated.

So I guess that there are users that do not have new fields in my database collection because they didn't open the add-on since new version is published, so their add-on stays as is?

This makes it hard to fix the problem that shows up in StackDriver log, because users do not know it, and they hardly open the add-on again if they don't need to change any setting.

Is my guess correct? Just want to hear your experience.

Thank you.

Alan Wells

unread,
Oct 19, 2019, 9:20:37 AM10/19/19
to Google Apps Script Community
If errors are showing up in your StackDriver log, that tells me that the add-on code is running without the user of the account that installed the add-on "being present."  (A trigger)  Your new version with the 1 hour time-based trigger must have code that needs to run to install the time-based trigger.  But something needs to run the code to install the trigger.  Just publishing a new version won't do that.  You must have the installation of the trigger tied to some code that runs when the add-on is opened.
The code that is causing the StackDriver log, could be used to fix your bug.  You could have a document property that is a boolean for "BugFixed" true/false.  The code to fix the bug runs once, fixes the bug, and sets the document property to true.  Your code would need to test for that "BugFixed" property every time it ran, but a few months later, you could remove that.

There must be an event that is triggering the code that is causing the error in your your StackDriver log.  That's the code that I would put the bug fix code into.

It's amazing how many users set up an add-on, and then never check it again.  I have errors from accounts that have gone on for months or maybe years.  I "blacklist" some of those people, so that I'm not getting errors from them constantly.

Hoang Trinh

unread,
Oct 21, 2019, 4:23:58 AM10/21/19
to Google Apps Script Community
Thank you, I understand.

So once the trigger is installed for a user, it will not be updated even if we published a new version of the add-on.

The only way is to tell users to re-open the add-on for at least one, and do something that will manually update the trigger.

Alan Wells

unread,
Oct 21, 2019, 9:30:52 AM10/21/19
to Google Apps Script Community
The code for the trigger can be updated when a new version is published. 

All the parts of making a "trigger" work consists of:

1) set-up - type of trigger - What event causes it to run - configuration settings eg. how often
2) the event - What is the Google server detecting to call the function name
3) the code associated with a function name
4) The function name

The time-based trigger needs to be installed.  That's the set-up, which consists of things like how often to run it.  The event is what is being "listened for."  What often happens is, that the use of the word "trigger" gets associated with just one, or some of those parts.  And the word "trigger" gets used interchangeably to mean the function, or the set-up, or the installation.

So, that leads to confusion and misunderstandings when talking about triggers.

If you change the code in the function that is linked to the trigger settings, then the trigger will run different code.

If that different code installs a trigger, then a trigger will be installed.  The code is what installs or doesn't install the trigger.
Just the act of publishing doesn't necessarily do anything.  I just didn't what you to think that just the act of publishing a new version would necessarily do anything.  It might, it might not, it depends on what the code does.
Reply all
Reply to author
Forward
0 new messages