all my GAS triggers (time based) in all my projects are disabled:
checking the trigger page shows a red "Disabled" under "last run"
and text inside says:
Disable reason
You do not have access to the target script.
can someone explain what is going on?
The error you obtained is caused by the following constellation
User A created a file
User A shared his file with user B
User B either created a bound script and attached an time-driven trigger to the script, or User B attached a time-driven to the script created by user A
User A stopped sharing the file with user B
User B is not allowed anymore to use a trigger on User A's file
User B's triggers become disabled and show the Disable reason "You do not have access to the target script."
Related
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.
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.
We're randomly getting this error for some of our users.
We're trying to access form by using this function
const form = FormApp.getActiveForm();
Here is the image of cloud error
Not able to understand where the issue is.
Any help is appriciated
I was investigating this issue and I found some information that might help you.
I found this post with 2 valid answers.
The first answer:
The following situation produces the error:
User A has access to the form and activates the addon / on form submit trigger
User B has also access to the form
User A gets removed from the form (IMPORTANT: the trigger does still exist within his/her environment: https://script.google.com/home/triggers)
User B continues to make surveys, let's say user C submits the form
The remaining trigger from User A fires and produces the error
The second answer:
I'm wondering if the error occurs to form collaborators (form editors, not the owner) that have not edited the form.
What about this "workaround"?
On your add-on function that creates the trigger using a try... catch try to get the Document properties. If there is an error, insert a question, then remove it.
Another thing I found here, is that the error might be related to: "The script was failing to run due to insufficient privileges granted to it"
This access is granted through the authorization window of what is in the OAuth scope when setting up the trigger.
Missing OAuth scopes for the project.
Third-party apps are created with insufficient permissions granted when setting triggers.
Error when fired.
Lastly, I found an issue tracker but with the FormApp.openById. If you test all the things above, your users are having issues. I will say to open a new issue tracker here
I created a sheet in my personal drive with scripts that used a modal dialog popup. Everything worked great. Granted permissions. I move the sheet into a new G suite shared drive. Regranted permissions to myself. Now, everyone that logs in with the G Suite account can do everything and it works. Using my outside account (the sheet is shared outside the G Suite), I can do almost everything, but I get
Execution failed: You do not have permission to call showModalDialog
With my outside account from the G Suite, am I now no longer allowed or able or can even grant that permission? Is there something else somewhere I need to do?
Unless someone else has a better answer, I believe that the permissions for the UI to come from an onEdit (or even a triggered onSpecialEdit) will not allow a modalshowdialog....except for the person to created the onSpecialEdit trigger based on onEdit.
Since onEdit are less intentional for the user, the types of functions that send emails or popUp on the screen with information is not allowed, except the one single person who created the script trigger.
To get around this, I needed to create and insert a graphic image to be a button. Assigned a script to the button. The script pulled a value off a hidden cell to determine which cell the action should be taken on (a column of data validation check boxes that I originally wanted to trigger), and then pass that value to the script with the UI.
That works, but just not as clean and simple as checking a box and seeing the results.
I have a Google spreadsheet with a function: appendComment that is attached to the onEdit installable trigger for the sheet.
Permissions for the sheet are set to both link sharing (anyone with link has edit permission) and specific users with edit access.
setting up:
I have a menu item added in the onOpen trigger which starts the script permission process, giving permission for the scripts to run for that user. It is a simple MsgBox call inside a function called getAuthorization. To initiate authorization for the scripts in the sheet, the user selects the only item from the "SCG" menu, which initiates the process.
the problem:
After authorizing the script, I make the trigger fire by clicking on a checkbox in a cell on the sheet (the appendComment function only operates when I click in that column), I get a permissions error that looks like this:
You do not have permission to call prompt (line 30, file "")
This is infuriating... can't find this problem and its resolution anywhere.
Both Browser.inputBox and ui.prompt cause the same error.
Here is a simple reproduction of the problem in a google-sheet for anyone who wants to take a look:
https://docs.google.com/spreadsheets/d/1WxVTulbqT8dtUlHEf_TW_Jaus5a1GSfXnjgdoWYhrls/edit?usp=sharing
Any help is appreciated!
To achieve the result I was going for... controlled comments history with easy comment entry by users on a sheet... I did away with the prompt boxes and just used the adjacent cell instead.
Ended up putting my function in the onEdit trigger.
No box neededed, no permission issues, works even better than with the checkbox.
I use the google app script in my google spreadsheet document.
The settings of each user of my spreadsheet doc is saved in:
var userProperties = PropertiesService.getUserProperties();.
To save the settings I use
PropertiesService.getUserProperties()setProperties({some properties}, true)
The problem is the first user saves his settings and another users get the settings of the first user using PropertiesService.getUserProperties()
But they should not, they should get own settings.
Do you have any idea how it is possible?
They must be logging in with the same user account for this to happen; a user can only ever access their own user properties. This could be because any triggers were created on your own account (say for form submissions), or web apps were deployed to run as you.
Share a copy of your sheet (andrew#roberts.net) if you would like me to a take a deeper look.
In fact as the support answered me, it is not a bug. I had wrong user properties on handling triggering event.
User properties are private to the user executing the script. However, when you setup an installable onEdit trigger, the code always runs as the user that setup the trigger:
"... runs with the authorization of the user who created the trigger, even if another user with edit access opens the spreadsheet."
https://developers.google.com/apps-script/guides/triggers/installable
Since the code always runs as the same user, it's always accessing the same user properties. In general it's not possible to get the identity of a user if they haven't authorized the script.