React-moralis 1.4.1 error Right-hand side of 'instanceof' is not callable

I got this console error when running react-moralis 1.4.1 and moralis 2.0.3

…index.esm.js:13958 Uncaught (in promise) TypeError: Right-hand side of ‘instanceof’ is not callable…

I did a test with an empty page to be sure it is not from one of my local components/code.

Other information:

react 18.2.0
react-dom 18.2.0

You will have to use a version lower than 2.0 for Moralis sdk with react

You may also have to use react 1.4.0

There are some similar forum threads with same issue

Execuse me, which react version? Do you mean react 14.?

I tried to downgrade moralis to 1.11.0 , still use react-moralis 1.4.1, react 17.0.2

but it is showing the same error

Tried with another combination of Moralis and React Moralis as suggested here (Updating moralis and react-moralis in nextjs app throws a TypeError: Right-hand side of 'instanceof' is not callable) but it doesn’t help too

[email protected] [email protected]
[email protected] and [email protected]

Now I think I will have to go back to react-moralis 0.3.1 and moralis 0.0.176

Try with a completely new folder. Or to delete all the dependencies from current folder

I wanted to say react-moralis 1.4.0

This is my issue too. Can we get a solid answer? For me, Moralis is useless now! I’m having too many issues, and it seems Alchemy might be a better option even though more coding will be required. Also, your API documentation is very confusing, and now we stopped our development all due to these errors! Can someone escalate this and get to the bottom of this, please?

function MyApp({ Component, pageProps }) {
return (


<Component {…pageProps} />


);
}

"@walletconnect/web3-provider": "^1.8.0",
"@web3auth/web3auth": "^1.2.0",
"babel-plugin-styled-components": "^2.0.7",
"dotenv": "^16.0.0",
"keccak256": "^1.0.6",
"magic-sdk": "^9.0.0",
"merkletreejs": "^0.2.32",
"moralis": "^2.0.3",
"next": "12.2.4",
"parallax-controller": "^1.5.0",
"react": "^18.2.0",
"react-alice-carousel": "^2.6.4",
"react-dom": "^18.2.0",
"react-moralis": "^1.4.1",
"react-scroll-parallax": "^3.3.1"

And if I downgrade to 1.4.0 I get this:

Moralis.onChainChanged is not a function
The above error occurred in the component:

at MoralisProvider (webpack-internal:///./node_modules/react-moralis/lib/index.esm.js:4299:23)
at MyApp (webpack-internal:///./pages/_app.js:32:24)
at ErrorBoundary (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:20740)
at ReactDevOverlay (webpack-internal:///./node_modules/next/dist/compiled/@next/react-dev-overlay/dist/client.js:8:23547)
at Container (webpack-internal:///./node_modules/next/dist/client/index.js:110:5)
at AppContainer (webpack-internal:///./node_modules/next/dist/client/index.js:702:24)
at Root (webpack-internal:///./node_modules/next/dist/client/index.js:853:26)

React will try to recreate this component tree from scratch using the error boundary you provided, ErrorBoundary.

Uncaught (in promise) Moralis SDK Core Error: [C0013] Key “serverUrl” is unregistered. Have you registered all required modules?

Thanks,
Benjamin.

For now you need to use [email protected] and [email protected] until the issues with moralis-v1 are resolved. You are trying to use the new 2.0 SDK which is different and won’t work with react-moralis.

If that doesn’t work, delete your node_modules and package lock and install everything again with npm if you used yarn (or vice-versa).

Yes, it does work with 1.11.0 and 1.4.0 - I was hoping to use the latest version. - Could you please point me to the proper documentation to call EVM API with these versions? I need to interact with contract.

I also want to ask what version of MoralisWeb3 should I install to use EVM API?

Thanks,
Benjamin.

You can look at the documentation for v1 if you want to use it in react. Moralis v2 doesn’t work directly with react.