You do not have permission to call showSidebar / showModalDialog - google-apps-script

I created a spreadsheet in Google Sheets several months ago and use the Google Analytics add-on. It has always worked fine until today, now if I try to create a new report, I see this error message:
You do not have permission to call showSidebar.
Run Reports shows:
You do not have permission to call showModalDialog
Schedule a report shows:
You do not have permission to call showModalDialog
I am but a humble AdWords consultant who knows just enough coding to break things. However, in this case, I haven't changed anything. All I did was try to run a report.
Any help would be greatly appreciated.

It appears that this would be the cause: https://issuetracker.google.com/issues/69238694#comment7
To ensure user safety, the ability to display dialogs and sidebars without explicit user action has been removed. We're still evaluating whether or not we can support these use cases again in the future. For the time being, we suggest that scripts that display dialogs or sidebars add a custom menu item (https://developers.google.com/apps-script/guides/menus) that users can select to open the dialog or sidebar.
So you can no longer show things automatically, but need a user to actually provide input.

It appears either my (or all of our) alert(s) were heard or someone in the GA group noticed a coding error.
I opened the sheet today, did a CTRL F5 (loads the page as if it were the very first time, for those of you who were not aware of this keyboard shortcut, it eliminates the need to go into settings and clear cache and/or cookies), ran my report and all worked as previously.

Related

Simple function suddenly throws "An unknown error has occurred, please try again later"

Since today morning, I am getting the below message while trying to run new App scripts on a new Google sheet.
Error An unknown error has occurred, please try again later.
My other App scripts attached to existing Google sheets continue to run fine. But if I create a new sheet and add even a plain simple function as shown below and try to execute this, I get the above error after it attempts to run it for some time and then gives up.
function Mytest()
{
}
I suspect that it is not able to bring the permission box which it use to bring up for any new script created. Till yesterday, once the permissions dialog box comes up and I used to give the permissions, the scripts use to run fine. But today it is not even bringing up the permission dialog box.
It looks like there is a outage going on with Google Apps Script when running new projects. I can see a couple of people reporting it in Google's public issue tracker.
It looks like it is only affecting new projects but most old projects are running fine. In the meantime you can add more info to the report to bring more attention to it. I have made some tests in 4 different accounts from different organizations and I can confirm I am also affected by this.
A couple users are reporting that it started to fix itself, and it looks like clearing cache and cookies from the browser may solve the issue (this is not a definitive solution but may work for you).
Only happens with Apps Script-managed Google Cloud Platform projects. Seems okay if you manually set the GCP project with the id using Resources > Cloud Platform Project...
I tried this because mine started with this error:
We're sorry, there was an unexpected error while creating the Cloud Platform project. Error code DEADLINE_EXCEEDED
I was having the same issue. Adding the script ID to the Library seemed to fix it.
Go to the "settings" option in the left menu of the script editor and copy the script id. Then click the plus icon next to the "Library" option and click "look up". Once the script is found, click "add" and run the script.

Google Sheets Script not sticky

I am trying to create a custom function for a Google Sheet. to do this, I start from within the Sheet that I want to use the function, I then go to the menu Tools|<>Script Editor.
I then write a function. Name the file. And save it.
But, I can not use this function. Error #NAME?
Then if I close the Script Editor and open it again, it's like I have never been there. It presents the same form you see when you first start.
From an OP comment
I have discovered the issue, but not the solution. When the script editor is opened it switches me to another Google account I have. So I switch back. But then I am presented within a screen saying Acess Denied and making me ask permission. To whom and what for I am not sure.
The solution to the root cause of the problem depends on Google, fortunately there are several workarounds.
Use Chrome in incognito mode with all the extensions disabled, then sign in on only one account (the key part is bold)
Use another web browser or web browser profile. Sign in on only one account (the key part is bold)
Signout of all your Google accounts, then sign in first on the account that you will be using for developing your scripts, then sign in on the other accounts. This still migth be problematic under certain circunstances.
Also, as good habit, when you click Tools > Open script editor to create a new bounded project, the first thing that you should do is give a name to your project.
Another god habit, before testing a custom function, be sure that there isn't a project file with a red asterisk (unsaved file). Contrary to spreadsheets, the Apps Script files aren't automacatily saved when a edit is made.

Google Apps Scripts won't ask for permission in Google Forms

I have written an application that requires several permissions. However, when I click through my google forms I don't get asked for these permissions. I can do the whole form to the end, but whenever I finish the form I get the error to my email (as I have the direct error messages to email feature turned on) that "permissions are required to run this script".
Does anyone know what can cause this problem?
I already found a fix for the issue. After a change in your code you have to go to the triggers menu and press save. Just that.
Seems like a bug that I had to do this.

Google purgeGmail script script suddenly turns up in my inbox with the status failed - what are my next steps?

My original question was asked in google's support forum (https://productforums.google.com/forum/?utm_medium=email&utm_source=footer#!msg/gmail/0t_T1zvYzJQ/xCPLQXpYBQAJ), then redirected to their dev support (https://developers.google.com/apps-script/support) which finally redirects to this site when clicked on "Ask a question". So please don't blame me for asking this question here.
Please refer to the first link above for my question. It contains a lot of details and 2 screenshots. I'm copy-pasting them here also but you are free to refer to that link for more details.
I received the following email. However, I don't recognize this "script" or what it means. I wasn't trying to run a "purgeGmail" script. Any idea what this email means or should be my next steps?
Your script, Copy of Gmail Purge - Digital Inspiration, has recently failed to finish successfully. A summary of the failure(s) is shown below. To configure the triggers for this script, or change your setting for receiving future failure notifications, click here.
Start Function Error Message Trigger End
1/17/17 12:13 AM purgeGmail Authorization is required to perform that action. time-based 1/17/17 12:13 AM
Sincerely,
Google Apps Script
Need help? Visit the Google Apps Script documentation. Please do not reply to this message. (c) 2017 Google
I checked my account activity and found nothing suspicious. I did change my password about 2 weeks back actually because I received an email alert saying "sign-in attempt was blocked - unusual activity".
However, I'm not sure whether this "purgeGmail" script is a default script gone haywire or is it some kind of custom script setup by someone. If it's a custom script then I'm going to delete it.
When I goto script.google.com it shows me "Triggers for script Copy of Gmail Purge - Digital Inspiration" > 4 options underneat - initialize, install, uninstall, purgeGmail.
Not sure how this ended up in my account. I would like to report this to the authorities so that they can take down this script. But I'm not seeing any link or option to report it to the authorities. (1) Any idea where I need to report it?
(2) Also, any idea whether this is a default script or custom script? If it's custom I'm going to delete it. I click the cross icon. The heading still remains but the 4 options are gone. Then there is a save button. I'm not sure whether I should click that save button. The UI just sucks for this whole thing.
Here's a screenshot for this whole thing. I'm guessing you can open this pic in a new window so that it shows the actual size. Just right-click "open image in new tab" or download and open should work as on most websites.
I figured out what to do in this situation and would like to post an answer here so that it may help someone else too.
This script has come via some unknown source. I'm not sure how that person got in but google had once given me an alert for my account activity following which I had chaned the password. Here are the steps which I took to remove that script. In other words if you ever get an email from google stating script xyz failed due to lack of permissions then you can do the following steps:
1) Observe that the script is named "Copy of PurgeGmail". Hence, it is not part of the usual Gmail because had it been so it wouldn't have been named "copy of". This is definitely the work of some person (which you can also see in the screenshots in the question).
2) The script wasn't running because the permission was missing. So the next step is to go to script.google.com, use your google account to sign-in by clicking on "Start scripting".
3) On trying to sign-in Google asks you whether you want to create an account in scipt.google.com . If you do get this confirmation then click yes.
4) Google takes you to the default script editor. It loads a "new script" with only 2 lines showing up in the code section.
function myFunction() {
}
If this code is not present then add it. To view the trigger settings the IDE requires you to have an error free code. If you have a blank canvas or any errors in the code then the IDE will give you an error and not allow you to navigate away from this page.
5) Once you've copy-pasted the code above just click on Resources> All my triggers. This should now open a popup that actually shows you the triggers with a delete button (cross button).
6) Click the cross button and it instantly deletes the script. Click okay to confirm.
Now the suspicious script is not present anymore and you should not receive any further notifications. Just to be safe double-check your secondary email address to safguard against a second attempt.

DriveEye only sends errors even after disabling it

I have added the DriveEye app to my Chrome, and enabled it to see my account. It is used for sending automated e-mail alerts on Google Drive shared folder activity.
It is not working. I receive only error messages ( I can not include it here as it is in Hungarian). It is about server error.
Then I removed the DriveEye from Chrome (drag and drop in the Chrome start screen). Nothing changed. I still receive errors.
How can I ged rid of it? How can I remove it completely or take the authorization back?
Thanks for helping
It seems I had the same symptoms.
There doesn't seem any way to remove DriveEye, but I found a way to delete its triggers, which stops the error emails.
Overview: The web-based authoring environment for Google Apps Script contains a menu item "Resources --> All Your Triggers". You can manage your Triggers here. (It appears to be the only place you can do this.)
Trick #1: Due to an apparent masking bug, you can't access this menu item unless you have at least one active script, and it is currently open. A completely empty dummy script will suffice.
Trick #2: Deleting the trigger(s) won't occur right away. You must preserve the script which you used to delete the triggers for an unknown amount of time. Might as well keep it indefinitely, I guess.
If you don't do any Google Apps Scripting, like me, you won't know how to get there. Go here:
https://developers.google.com/apps-script/
and click on the link "Start Scripting". Choose "Create script for ...Blank Project". You'll get an Untitled project window. Save the project with a descriptive name (e.g. "Dummy Scripting Project"). It will appear among your Google Drive (GD) files. (I used the GD web interface for this.) Reopen the script, access the menu item "Resources --> All Your Triggers" and delete DriveEye triggers. Save and close the project.
Now wait. In a few days, all the DriveEye error messages should cease.
HTH