Moralis Web3API CORS getTokenPrice [SOLVED]

Hi, recently I switched to new SDK and i see many CORS errors, I saw YT video about solving CORS problems and moving to cloud functions but I cannot see how to use new SDK:

like normally was getting token price:
const price = await Moralis.Web3API.token.getTokenPrice(options);

now get error:
Access to XMLHttpRequest at ‘https://yr9arcyilvx1.moralisweb3.com:2053/server/functions/getTokenPrice’ from origin ‘http://localhost:1234’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
RESTController.js:309 POST https://yr9arcyilvx1.moralisweb3.com:2053/server/functions/getTokenPrice net::ERR_FAILED

Can you explain this to me?

Hey @legenuspl

Web3API is for the SDK only. Could you check the URL+APP_ID and update the server version to the latest.

url and app id are correct, bacause i get token balance and transactions, but sometimes it gives error like above CORS, server is the newest version as well

There was a problem on our side. Try again please. Now it should work correctly :man_mechanic:

works now nicely :slight_smile: I have another maybe not so important COEP error:
Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep

it’s strange because it is on page load, refers to moralis.js:1

Please create a new topic and share the code example :man_mechanic: