Initialized, run Web3Api.initialize first

Hello, me too since today it does not work.
I changed this in my 2 .js files

I also checked my version in the console and I have ‘js0.0.87’

But I have his mistakes:

Access to XMLHttpRequest at 'https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:27851 POST https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice net::ERR_FAILED
dispatchXhrRequest @ moralis.js:27851
xhrAdapter @ moralis.js:27687
dispatchRequest @ moralis.js:28245
Promise.then (async)
request @ moralis.js:28061
Axios.<computed> @ moralis.js:28087
wrap @ moralis.js:28567
(anonymous) @ moralis.js:6347
tryCatch @ moralis.js:26918
invoke @ moralis.js:27148
(anonymous) @ moralis.js:26973
asyncGeneratorStep @ moralis.js:26427
_next @ moralis.js:26449
(anonymous) @ moralis.js:26456
Wrapper @ moralis.js:31028
(anonymous) @ moralis.js:26445
(anonymous) @ moralis.js:6381
(anonymous) @ moralis.js:6770
tryCatch @ moralis.js:26918
invoke @ moralis.js:27148
(anonymous) @ moralis.js:26973
asyncGeneratorStep @ moralis.js:26427
_next @ moralis.js:26449
(anonymous) @ moralis.js:26456
Wrapper @ moralis.js:31028
(anonymous) @ moralis.js:26445
(anonymous) @ moralis.js:6781
getPrice @ main.js:3
(anonymous) @ VM130:1
moralis.js:28189 Uncaught (in promise) Error: Network Error
    at createError (moralis.js:28189)
    at XMLHttpRequest.handleError (moralis.js:27758)
createError @ moralis.js:28189
handleError @ moralis.js:27758
async function (async)
getPrice @ main.js:3
(anonymous) @ VM130:1
moralis.js:27851 XHR failed loading: POST "https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice".

It looks like you have a space at the end of your server_url

1 Like

Ok thank you very much and excuse me, I’m going to go and hide.

2 Likes

Can you help me with this? I have a similar problem.

You can use:

web3 = await Moralis.enableWeb3()
address = (await web3.eth.getAccounts())[0]

It worked. Thanks.

How do I stay up to date on such changes?

for me it works Moralis.User.current().get("ethAddress") too

Hello Team. I’m Getting this error. help is needed.

MoralisWeb3Api.js:369 Uncaught (in promise) Error: This Moralis Server is rate-limited because of the plan restrictions. See the details about the current rate and throttle limits: {"x-rate-limit-limit":"25","x-rate-limit-remaining-ttl":"5","x-rate-limit-used":"45","x-rate-limit-remaining-ip-ttl":"5","x-rate-limit-ip-used":"45"}
    at Function.<anonymous> (MoralisWeb3Api.js:369:1)
    at tryCatch (runtime.js:63:1)
    at Generator.invoke [as _invoke] (runtime.js:294:1)
    at Generator.throw (runtime.js:119:1)
    at asyncGeneratorStep (asyncToGenerator.js:5:1)
    at _throw (asyncToGenerator.js:31:1)

That error says that too many requests were done in a second. You have to add a delay between requests or get a plan with more requests per second for web3api or somehow to make fewer requests in a second.