CORS error when querying from localhost
Sometimes I see the following error:
Access to fetch at 'https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
request.js:145 GET https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd net::ERR_FAILED 429
Is it possible to set the no-cors request mode as suggested by the error?
Actually according to https://stackoverflow.com/a/43268098/179332 no-cors is not the right solution. But then what is? Most articles I can find suggest that the problem is relating to the server sending out the wrong headers. But this doesn't explain why a lot of the time it works fine for me from localhost, and just occasionally it doesn't.
Hey, did you figure this out?
Hey, did you figure this out?
Yes
Sometimes I see the following error:
Access to fetch at 'https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. request.js:145 GET https://api.coingecko.com/api/v3/simple/price?ids=solana&vs_currencies=usd net::ERR_FAILED 429Is it possible to set the
no-corsrequest mode as suggested by the error?
Yes
Warning to Googlers - Please read the linked Stack Overflow post above before following @HelpSupports advice