1

Problem:

I am getting the error Exceeded maximum execution time after about 45 seconds.

Expected behaviour:

The function should run for 6 Minutes. After that duration I would expect an error. I checked up the current quota limits here: https://developers.google.com/apps-script/guides/services/quotas#current_limitations

My setup for testing:

I tried to remove all code and just have a single function "runFor6Min()" which only executes:

Utilities.sleep(6000 * 10)

I assume that the function should be treated as a Script runtime (6 Min) and not as a Custom function runtime (30s) e.g. a custom function within a Google Sheet.

Any ideas what else I could try?

Appended appsscript.json enter image description here

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Vinz
  • 87
  • 1
  • 6
  • Show your appsscript.json – TheMaster Apr 03 '23 at 15:46
  • Updated the question ... what are you looking for exactly? – Vinz Apr 03 '23 at 17:29
  • For future reference, always include data as plain text and not as image(some would like to actually test your issue and it's impossible to copy/paste a image). And provide all the data as a [mcve]. For eg, your question is missing the connection between `onDefaultHomePageOpen` and `runFor6mins()`, which is where the actual issue is. – TheMaster Apr 03 '23 at 17:46

1 Answers1

4

If you use CardService to call server side functions, you're limited to 30s of execution time as written in the documentation:

Warning: The Apps Script Card service limits callback functions to a maximum of 30 seconds of execution time. If the execution takes longer than that, your add-on UI may not update its card display properly in response to the Action.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
  • This is probably the root cause - thanks for pointing me into the right direction. Do you have any idea on how to trigger a longer running function from a Card Service Action? – Vinz Apr 03 '23 at 18:38
  • @Vinz You can try setting up a trigger like https://stackoverflow.com/a/62807671. But you won't be getting the output of that function directly. You may ask a new question regarding this. – TheMaster Apr 04 '23 at 05:52