Error: could not detect network

I am trying to connect to the speedy bsc mainnet node but i suddenly get the following error:
Error: could not detect network (event=“noNetwork”, code=NETWORK_ERROR, version=providers/5.1.2)
I’ve been using the same code for a few days now and it was working fine until +/- 30min ago

I’ve been using the following code to connect:

import {JsonRpcProvider} from "@ethersproject/providers";

const bscProvider = new JsonRpcProvider('https://speedy-nodes-nyc.moralis.io/1a4cf06cb1679546794a3383/bsc/mainnet')
    console.log('Waiting for network')
    const network = await bscProvider.detectNetwork()
    console.log(network)

(the code is recuded to just the related parts)

1 Like

Hey @michelsteege

Thanks for reporting that problem! We are currently working on fixing it.

We’ll let you know how we finish :open_hands:

Hey @michelsteege

Please check how it works now? :grinning:

It works again, thanks!

1 Like

Happy BUIDLing :muscle:

1 Like

Hello! I have this problem now repeated for the second day, this problem may be related to exceeding the limits on requests?

I tested now with this code and it looks like it works:

x = async () => {
    const  Ethers = require('ethers')
    const bscProvider = new Ethers.providers.JsonRpcProvider('https://speedy-nodes-nyc.moralis.io/[id]/bsc/mainnet')
    console.log('Waiting for network')
    const network = await bscProvider.detectNetwork()
    console.log(network)
}
x()

you get that error from time to time and not every time?

This error usually occurs ± 5 minutes after I launch an application that, using websocket connection, constantly receives new blocks, after which it makes requests to receive transactions from this block. That is, this error occurs strictly after some time, not always

if you want to get all the transactions from a block, then you have a chance of getting to a limit

in case that you don’t need pending transactions, you could try to use getBlock api function: https://docs.moralis.io/moralis-server/web3-sdk/native#getblock