Eloise1988/COINGECKO

RangeError: Maximum call stack size exceeded (anonymous)

bryan-atk opened this issue · 7 comments

Hello!

Very much appreciate your work. This is a useful tool. I've installed the updated code into the script editor in Sheets. I can't get a clean run. I receive the following error. I'm not a coder so this might be obvious to someone else.

Please advise.

RangeError: Maximum call stack size exceeded
(anonymous)@ Code.gs:1

Hello,

Thanks for your message. Can you print screen your formula and result ? It will give me more information in order to help you.

Thanks for the prompt reply. I believe this is what you want, but let me know if you need something different.

Screen Shot 2021-05-05 at 4 48 09 PM

Screen Shot 2021-05-06 at 8 34 00 AM

Screen Shot 2021-05-06 at 8 34 19 AM

I updated the code as there were multiple bugs with it. New version of CoinGeckoV2.gs can be found here:
https://raw.githubusercontent.com/Eloise1988/COINGECKO/master/CoinGeckoV2.gs

If you are requesting multiple tickers, try to request 5 and then expand. The code deals with caching values, so when the text that is cached is too long, it can't cache it and it returns an error.

In order for me to really understand what is going on, I would need to see the interface with the formula like on the shared image.
Screen Shot 2021-05-06 at 15 34 05

I don't know anything about "requesting multiple tickers", as I'm new to this, but if you can direct me I will change this setting.

This is the formula I use in the interface. It was working up until this update. Thanks

Screen Shot 2021-05-06 at 11 59 41 AM

Hi all, I am getting this same issue @Eloise1988

I am testing in a brand new google sheet, latest version of script:

image

Just one ticker:

image

Error:

image

I have coingecko pro API inserted, and a GCP account. Ideas?

Google Sheets has API limits.
For Google Limits:
https://developers.google.com/sheets/api/limits
https://developers.google.com/apps-script/guides/services/quotas

If you want to trouble shoot the functions to see where it goes wrong, a first step is to go and app-script and get the error message which should give you more information.

Limits are per account not per sheet.

Functions will go back to normal in a couple of hours when Google resets your daily limits.

Tips:
1- delete all formulas that have duplicates and reference just one of them instead of calling 10 times the same formula
2- batch refreshes into multiple calls of 20. Google limits with max 30 formulas at once.
3-check in spreadsheet setting/calculation/recalculation is on change uniquely
4- check in tools/script editor/overview your overall function consumption with error rate. It will guide you on understanding where you stand in terms of limits with Google
5- getting a premium account on Google also helps but you are still limited.. https://developers.google.com/apps-script/guides/services/quotas
6- It could also probably help if you had a checkbox which all CoinGecko formulas run on (if(checkbox=true, geckoprice(..)). Then just untick before closing the sheet so that the calls don't run in the background. Example: =if(Overview!$O$2=true,GECKOPRICE(B3:B12),"Tick refresh box"). I just tick the box when I open the sheet and then all the data loads. Then I untick before I close it.

These points should help you limit the #ERROR maximum execution exceeded.

FYI: The limitations don't come from my API. Currently, there are NO limits for my users. I don't have any partnership with GOOGLE.

When you get errors and think Cryptotools functions are down, you can check their operational status here:
https://stats.uptimerobot.com/NWoqAINy4q

Hope these points help!

For maximum call stack size exceeded:

When you call Coingecko formula with arrays of ticker, try to limit them to 10-15 tickers. If you put more, google can't store deal with the size of the array stack.