Urlfetch stucked in loop

132 views
Skip to first unread message

Henrik Bergström

unread,
Mar 24, 2021, 3:59:01 AM3/24/21
to Google Apps Script Community
Hi,

I have a Google App script (GAS) add-on for Sheets in 'Google Workspace Marketplace'.
The Script calling Urlfetch to get data from our API.
The user provide a APIKEY to identify user and get access.

The user can trigger the URL fetch from custom function OR from a Menu 'Refresh' button. 

The Addon has worked fine for several month - but now I have one user that made a sheet that calls the API 'forever'.  

The Problem

One user has created a Sheet that calling Urlfetch over and over again.
I talked to user and checked his sheet. There is no triggers or loops in the sheet.
On my account the users sheet works fine.

The users Sheet has around 1000 API calls (big sheet) and I can see in Google Apps Script Log that the calls in looping. There is 1000 calls in log and then stops and wait for some random time of maybe 20min and starts over again.

Today I had 30k api calls in last 24h from this sheet.
I dont know how to stop it.

The user does not have the sheet open in any webbrowser.

What I tried
1.
The user has tried to make a copy of the original sheet and then deleted the original sheet to see test if Urlfetch stops.
This did not work. The Urlfetch continus to call API.

2. 
I made a new Version of Addon and deployed.
I hoped that a new version could tell Google server to stop/restart the sheet.
This did not help.

- What can I do to stop this script from running forever, for this user?
- Is any way in Google Admin to stop the script from running?

I could hardcode into Addon the User APIKEY and block it, but this is ugly.
I dont want to do this.

Any help is appreciated,

Br,
Henrik


Bruce Mcpherson

unread,
Mar 24, 2021, 4:56:20 AM3/24/21
to google-apps-sc...@googlegroups.com
Sounds like the ‘custom function’ version is being continuously recalculated and refetching. 

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/03fdca6d-03fb-4735-88aa-04c611842fd7n%40googlegroups.com.

Henrik Bergström

unread,
Mar 24, 2021, 6:24:33 AM3/24/21
to Google Apps Script Community
Yes.
For some reason the Server keeps re-running the script from start, over and over again.
I have a copy of the users sheet, and I can run without any problems. I see the 1000 api calls once and then it stops correctly.

For me this looks like a problem on Google Server and not in the Sheet.
The user even deleted the original sheet.

The problem is that I don't now how to stop the script from running?

Do you have any ideas?
Thanks,

Alan Wells

unread,
Mar 24, 2021, 11:07:01 AM3/24/21
to Google Apps Script Community
Open up the list of your projects:

Find the project that your add-on is based on.
Click the 3 dots at the right.
Choose "Executions"
Click the "Add filter" button with the plus sign.
Choose "Ran As".
Choose "Anyone"
Click Apply.
You will see executions that are being run from your add-on users.
Click in the filter address bar again to add another filter.
Choose "Status".
Click the "Running" checkbox.
If you see a very long running execution, then click the 3 dots icon.
Choose
TERMINATE

Henrik Bergström

unread,
Mar 25, 2021, 12:39:22 PM3/25/21
to google-apps-sc...@googlegroups.com
Thanks alot!
I think this was the solution. 
Great to know how to Terminate for one user.

Br Henrik

You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/HYdqKEGN2rE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3719bf53-08c4-4644-ab4b-ebfcf1b11a79n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages