Moralis Web3 Not detecting connected address [SOLVED]

I have a problem getting not only address but it seems that the moralis web3 is not connected to any account. Plus I can’t perform any wallet transaction as the moralis web3 detects no connected wallet according to the code below:

   const web3 = await Moralis.enable();
    const owner = (await web3.eth.getAccounts())[0];

The above code returns [] an empty array even if I have been logged in and authenticated.
This problem only persists when I use the moralis speedy node of bsc testnet. But when I use the speedy node of mainnet. It works fine and I can get the address also I can perform other web3 related works like transfer etc.
Any idea what’s wrong with it?

What you have at the beginning of you html page, where I have this (assuming that you use vanilla js):

    <script src="[email protected]/dist/web3.min.js"></script>
    <script src=""></script>

What did you use as a RPC address for Binance testnet?
Does it work fine if you change to ETH or other network?

Just tested it with Moralis Testnet speedynode - it worked fine

Sorry guys. Silly mistake. The web3 did not seem to accept the universal rendered async data (server side rendering) and I had a component that did set the web3 variable locally instead of globally.
But it’s weird why every network (rinkeby, matic) worked but not bsc tested.

Thanks for the help!. Both my threads have been resolved now.
Thanks a lot!
@cryptokid @Yomoo

1 Like

It’s really cool that a solution to the problem has been found. Nice job @resourcelink123

Feel free to ask any questions.
Happy BUIDLing :man_mechanic:

1 Like