Moralis.web3ByChain doesn't work with Goerli testnet

Hi,

I’m not able to access to web3 on Goerli Testnet within my cloud functions.

Moralis.web3ByChain('0x61') // Bsc testnet This is working
Moralis.web3ByChain('0x1a4') // Goerli not working
Moralis.web3ByChain('0x1A4') // Goerli with capital not working
Moralis.web3ByChain(420) // Goerli decimal chainId not working

something like this works?

web3 = new Moralis.Web3(new Moralis.Web3.providers.HttpProvider(“https://speedy-nodes-nyc.moralis.io/…”));

Seems like the function is not working in cloud functions. I tried with and without new Moralis.Web3.providers.HttpProvider inside new Moralis.Web3, but it’s not passing…

    const web3 = new Moralis.Web3(
      'https://speedy-nodes-nyc.moralis.io/*******/eth/goerli',
    ); // NOT PASSED

    const web3 = new Moralis.Web3(
      new Moralis.Web3.providers.HttpProvider(
        'https://speedy-nodes-nyc.moralis.io/*******/eth/goerli',
      ),
    ); // NOT PASSED

I tested now this code: Got error in CloudFucntions Web3 call [SOLVED]

It’s working thanks !

1 Like