BASE Chain on Self-Hosted Moralis Server


I am trying to implement BASE chain in my dapp, however the Self-Hosted Server doesn’t seem to support it. Is there a workaround for this? Thank you.

ERROR: chainId moralis.js: 27019 must be one of the following values: 1, 5, 11155111, 137, 80001, 56, 97, 43114, 43113, 250, 25, 338, 1337 at handleError (moralis.js:27019:17) at async login (login.ts: 19:23) at async handleWalletClick (login.ts: 88:5)

Hi, for auth api you can hardcode chain id 1, because it will not make a difference if other chain is set

I am already using chain id 1 for Ethereum Chain. I need to enable Base chain but it doesn’t seem to be supported at the moment. I need to connect a MetaMask wallet to my dapp and authenticate the user.

In your authentication logic you can use chain id 1 everywhere to fix that error with unsupported chain

I still don’t understand how to do that. I need a user to connect with MetaMask then switch to Base chain within my dapp. How to trigger a smart contract on Base chain and pay the gas fees if the chain id is hardcoded to 1?

This hardcoded value is only for the use of Auth API. Your wallet can still be connected to the correct Base chain.
The transactions and contract calls will not be affected when you are connected to the correct chain in your wallet.

1 Like

Got it, I finally made it work. Thank you, much appreciated!

1 Like