Suddenly: Service using too much computer time for one day - google-apps-script
I have been putting out fires all day. Can't seem to make heads or tails of this error...
Today I started for the first time after months of using the same script. It is triggered when a new record is added to a google sheet.
It seems to work on and off but every few minutes I am getting a failure notice indicating "Service using too much computer time for one day".
Looking through the documentation and the post on Stack, it is clear I am not the first to deal with this issue, but there does not seem to be any concise answer to how to resolve. I looked for some way to reach some type of google assistance but am always directed back to stack overflow to submit my issue for consideration. Understand this could be an issue with my script, but cant seem to find what might be causing this issue. Also confusing the matter is that the script does seem to be firing 90% of the time.
My questions:
How do I check the "computer time" quota?
Should I turn off that script/trigger until 24 hours have passed?
Does anyone know how to get a hold of Google support directly?
I don't know of any way that the total script run time can be seen in a dashboard.
You can see duration times of individual script executions at:
https://script.google.com/home/executions
You could scroll through your executions to look for long durations times. That might indicate an endless loop in your code.
To calculate the total run time of all your running scripts, you'd need to use the Apps Script API.
https://developers.google.com/apps-script/api/how-tos/view-processes
https://developers.google.com/apps-script/api/concepts/processes
I don't have any code to list and compile all the durations.
If anyone does, that would be very interesting.
I don't know if deleting the trigger until the next day would gain you anything. I'm guessing that it shouldn't.
Google does not provide "on demand" support people to answer questions about Apps Script. Even G Suite customers don't get "on demand" support contacts for Apps Script. You can report bugs and request features through the Google Issue Tracker, but that won't get you direct contact with a Google support person. Even if you purchase a support plan, Google doesn't have people who are designated to support Apps Script. If you purchased a support plan, they might try to help you with an Apps Script question, but officially they aren't qualified to help, or obligated to provide Apps Script support. And even if a support person tries to help you with an Apps Script problem, the first thing they'll do is a search of Stack Overflow, and give you links to SO posts.
So, it's extremely unlikely that you're going to be able to talk with someone directly at Google.
The best thing to do is to review your code for performance issues. Avoid reading the writing data often. The ideal situation is to get all the data that you need just once, process it, and write it back once. Cache data if you can. Avoid lots of calls to Properties Service. Find what part of your code is taking the longest time, and try to improve it.
Related
Assuming I have edit access to a Google Sheet, how can I write to it programmatically?
A friend has given me edit access to a Google Sheet he owns. I want to write to it via web server code hosted elsewhere---at Wix, actually, where I've built a page that wants to update the spreadsheet from time to time, perhaps a dozen updates per day. I have found several technologies that might solve the problem. Google Apps Script is one, the Sheets API another. The latter of these is (as far as I can tell) really three distinct options depending on authentication scheme: API key, service account, or OAuth2. The question is this: Given my specific situation, which of these four approaches (or others I haven't found) is feasible and most appropriate? I'm not asking for opinions; I just don't want to go down one path only to learn later that it's an unworkable dead end (as preliminary research suggests that API key might be) or absurd overkill (as preliminary research suggests that OAuth2 with a Google-approved app might be). Note in particular that I have edit access to the spreadsheet in question and can give that access to others if necessary. If the choice depends on factors I haven't mentioned, what are those factors?
Re-authorize hundreds Google scripts indefinitely
I have about 700 Google sheets, running scripts. For too many years now, I have to re-authorize these scripts indefinitely. Of course, I searched the net, I simplified my scripts to minimize the number of services called. Recently, I was hoping that the Google Alpha V8 script could have helped me, but no, definitely no. Still no solution. My hundreds of sheets are opened by the employees of my company, therefore hundreds of scripts linked to these sheets are automatically used thanks to triggers (simple and installable triger) It seems obvious that there is a limitation on the number of scripts allowed at the same time. This limitation having been visibly reached for years, I have to re-authorize, every day, some scripts. But by doing this, I guess I am revoking so many other scripts. How Google decides to revoke this or that script, I don't know. I guess the least used. Why this limitation? Is it possible to increase it? If not, what is the solution? I add I found this page https://developers.google.com/apps-script/guides/services/authorization , which is talking about OAuth application user limits (at the very bottom of the page) . I wonder if this could help me. Thank you. I worked on my topic, reading a lot of english docs... I painly read and slowly understood them. I hope so ! As I could expected, I hit on restrictions, placed by my organization, I imagine. I am unable to create project. See 1 In the same time, and strangely, I own several projects. 2. I don't know why they exist, even if I recognize their names which are those of several of my scripts. Anyway if I want to publish my script as an Add-on, I have to "link" my script to a "standard GCP project". As it is impossible to create specific projects, I tried to follow a google procedure, consisting to link my script to an existing project. But as it was expected, it does not work either 3 If someone had a good suggestion, it would be welcome. Thx. JM.
Convert your scripts to an add-on. Then these add-ons can be shared across users and spreadsheets, and you can actually reduce the number of places you need to maintain code. You can view the publishing guide here: https://developers.google.com/gsuite/add-ons/how-tos/publishing-editor-addons A second solution is to create a standard Google Cloud Platform project and change (some/all of) your scripts to use it, rather than their own hidden GCP project. More info about this step: https://developers.google.com/apps-script/guides/cloud-platform-projects Note that both of these solutions will result in sharing of certain quota limits, which may mean you need to redesign or update how you do things However, both of these changes provide increased visibility into the errors that your scripts encounter, as you no longer have 700+ places to check for error reports, just a 1 or a handful.
Unverified developer warning in personal app script
Some days ago I wrote an app script with some support features to help me to take notes of my time in a google doc. It's my first one, I just wanted to test it and see if it could replace Microsoft Word Macros. The script is bound to the doc but I duplicate the file for each task I want to track time for. I don't intend to publish anything of the sort with google. It's just for my own use. Now I have a bunch (like a lot) of 'unverified developer' warnings in google security page. Is there any easy way to tell google to f... off? I'm kind of offended... unverified... as I wasn't enduring this business the last almost 20 years. 8oD
Google App Script limits on number of times doGet can be called
The google script limitations link shows that we can do URL Fetch calls 20,000 / day. Now thats looks quiet ambiguous to me. Inside script, you can use the UrlFetchApp to make get/post requests to external urls. But what if we are calling a deployed google script from external non script client(e.g. web browser/mobile device ). Does that imply that we can only call the script(with url say abc/exec)20000 times a day(20000=total sum of times the script is called from all client devices) from outside of google app script?
I don't see the relationship between fetching an URL from within a script and running an app from a browser. I never saw any mention of a limit about how many times a webapp could be called but there are probably limits on the total processing time a script can use. The quota dashboard specifies the maximum processing time used by triggers, it does not however specify a limit on processing time by a human user. If Google does not specify it that means they don't care or that they don't want us to know... in both case the result is the same: we have no way to get the info. That said, I never encounter any issue with an app being called too often even if I know that some of them are heavily used sometimes. Was your question purely rhetorical or did you experience some real situation?
ScriptDb remaining quota
Is there a way to find out what your remaining ScriptDb quota is? (Adding records until i fill the scriptDb just doesn't seem like a good way to find out your db's limitations)
This feature isn't currently available. The Apps Script team is looking to make this data available via the quota dashboard sometime in one of the next few releases. If you need access to this programmatically, it'd be a good idea to file a feature request in our issues tracker.