Unknown error came out of nowhere

I started seeing this error recently, and not sure why.
My guess is… it is related to recent sdk upgrade.
Please suggest a solution.

image

This error was showing while running “Moralis.getChainId()”

I solved it by updating Moralis.getChainID() with
window.ethereum.request({ method: 'eth_chainId' });

and again i started getting the same error while subscribing to queries. query.subscribe();

1 Like

or i could be wrong. I tried disabling the function and it is still happening.

it could be related to this: Moralis JS-SDK v1.0.0 [beta] (Ethers.js support)

These are the following things which i updated based on the ether.js thread.

  1. Updated cdn & unpkg paths
    <script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
    <script src="https://unpkg.com/moralis@latest/dist/moralis.js"></script>
  1. updated calling web3
Moralis.start({ serverUrl, appId });
async () => {
    await Moralis.enableWeb3()
    const web3 = Moralis.web3;
}
  1. And updated the way network /chain is tracked using Moralis.switchNetwork and window.ethereum.on("chainChanged", async(chain)

What else is remaining to change?

I don’t know, you can ask in that specific thread

1 Like