I'm trying to upload a larger size document from a gmail add on but I keep getting "Gmail could not perform this add-on action" when I try to hit my endpoint because it takes too long and I "Exceeded maximum execution time" of 30 seconds. Is there a way to increase the maximum execution time or at least catch the error and display something else other than Gmail's runtime error message?
Asked
Active
Viewed 513 times
2
-
1Please post your code. – Steve Gon Jul 03 '18 at 23:22
-
You can wrap the offending code in a `try\catch` clause to catch and handle the exception. – TheAddonDepot Jul 04 '18 at 13:05
-
I tried that, it doesn't throw an exception, it just quits. – JKhoo Jul 05 '18 at 16:22
-
I think you're going to want to do potentially long operations like file upload from client-side HTML. Even if the file is small, a shoddy internet connection will make a small file upload take too long. – tehhowch Jul 23 '18 at 14:44
2 Answers
1
I found some Google documentation that sheds light on this issue. Check out the Callback Function section of this page. Card Service limits your callback function execution time to 30 seconds.
You may have to settle for Tom's answer. I'd also add size restrictions to the files that you're working with so that you can rule out files that are obviously too large for Card Service. I'd be interested, though, if you found a better solution than this.

Mike H
- 35
- 7
0
If you have a log method that you call often, you could add a check like "If the script is running since more than 25s, throw."

Tom
- 4,666
- 2
- 29
- 48