Google Apps Script error - Service unavailable: Gmail - google-apps-script

My Google Apps Script time-based Trigger is failing with error:
Service unavailable: Gmail (line XXX, file "XXXXXXXXXXXX")
The code gets emails from a Google Sheet and send emails to them.
My spreadsheet has more than 8k+ records.
Initially I suspected error due to data loading, but later I realized that it is not due to load as my friend is able to run the script smoothly without any error from her gmail account.
I have checked my gmail storage limit and freed up.
Cleared browser history and cookies.
Please help this issue resolved and let us know some precautions or steps to prevent this happening in future.

Related

How to continue using google scripts?

Google sent me an email to do app verification to be able to continue using the gmail api. My app is basically a bunch of scripts running in spreadsheets that send an email notification when a change occurs.
Having to get a gsuite account and going through App verification to allow my scripts to survive seems very heavy process.
Does anyone know if all these spreadsheet scripts will now be stripped of their ability to send emails in the new year? or if they can continue as long as you are running them only under your own account?
I have not been able to see any documentation on this to confirm one way or another.
Seeing process described for verification here: Google app script verify scares me!

"Authorization is required to perform that Action" Error on a copy of existing code that works

I'm using Apps Script and the OAuth2 for Apps Script Library to connect to a couple Google advertising platforms. Basically, each account team has a Google sheet that automatically gets their campaign data every morning. I've got a couple of these sheets up and running already, but when I try to set up this most recent sheet I'm getting the "Authorization is required to perform that Action" at the very end of the OAuth process. I'm able to start the OAuth dialogue, select an account to authorize, but then I run into the error.
I authorized the script in the script editor before I ran it, and all of my OAuth credentials are correct. I've even deleted and re-created the scripts. The other sheets running the same scripts are still working fine.
What's going on here? I'd appreciate any ideas, I've set up a couple test sheets to see if I can puzzle it out, and now they're all returning the same error.
Update: Everything works properly when run from a different account, so it's looking like it's a problem with my account, specifically. Is there any way to manually check that an Apps Script project has been authorized correctly on a given account, aside from the prompt when the script is first created?
I ended up fixing it by explicitly setting the Authorization Scopes in the manifest. In case anyone finds this question later, here's the links to the relevant Apps Script guides:
Authorization Scopes:
https://developers.google.com/apps-script/concepts/scopes
List of OAuth 2.0 Scopes:
https://developers.google.com/identity/protocols/googlescopes

how to stop a google apps script - have already revoked permissions

I ran the Drive Migrator script to try to move some files between 2 google accounts. It failed and kept sending me error emails, so I tried to turn it off by by revoking the Drive Migrator permissions inside my google account settings. Now I get a different email every day, saying that Drive Migrator failed to run because it requires authorization, so it is still running somewhere but I can't find any reference to it in my google account settings. The error email contains a link where I am supposed to be able to configure triggers for the script, but the link just loads a "Forbidden Error 403" page.
Thanks
Open Google Apps Script (can be any script). Remove any triggers that fire the migrator. Revoking the permissions would only cause an error message to be sent out, as the script will try to run due to the trigger. It tries to get through the oAuth and fails, causing you to receive the error.
A trigger is the only thing you need the script to attempt to run. Authorization is needed to actually perform some of the tasks in the script. Heck, some scripts can be run automatically with no authorization whatsoever. Always get rid of any triggers you no longer need.
Try this:
Go here:
https://security.google.com/settings/security/permissions
Scroll down and select "Drive Migrator" then select "Remove".
(It was mentioned in the app reviews)
I went to the respective script and just added /* and */
/*
script here
*/

Any way to suppress "Summary of failures for Google Apps Script" emails?

I have a Google Apps Script that customers install using the "run script as user" option. Unfortunately, my script has a try/catch block around all of the code but it seems that occasionally errors still slip by and customers receive a "Summary of failures for Google Apps Script" email (usually just due to a temporary Google server error).
Is there any way to permanently suppress these emails from being delivered to customers of Google Apps Script applications (or redirect them to the script developer)?
You have two options here. You can either disable the error message being emailed when the trigger fails, or instead you can see if you can get your Application published as an Add on, as Add-ons are the 'Official' publication, and don't allow End users to receive any backend error messages.

Server Errors in Google Apps Script

Every morning I get an email from Apps Script saying this:
Summary of failures for Google Apps Script: Not found‏
Your script, Not found, 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.
When I click the link in the email, it tries fetching the triggers but returns another error:
We're sorry, a server error occurred. Please wait a bit and try
again.Dismiss
How do I get rid of these messages?
There is a topic about this problem on the GAS issue tracker. Please star it to promote it to the support.
How do I get rid of these messages?
Now a solution is to filter such messages in your email system or to wait when the GAS teams fixes it.