Skip to content

error in jsonRpcProvider #4827

Closed
Closed
@block98ct

Description

Ethers Version

6.13.2

Search Terms

No response

Describe the Problem

JsonRpcProvider failed to detect the network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)
getting this error on the server on my local machine it is working fine

network:- polygon-amoy
infuraUrl:- https://polygon-amoy.infura.io/v3/${myPrivateKey}

Code Snippet

const contractInstance = async (privateKey, address, abi) => {
  try {
       const wallet = new ethers.Wallet(privateKey);
       const provider = new ethers.JsonRpcProvider(
       process.env.INFURA_PROVIDER_URL
      );

    const connectedWallet = wallet.connect(provider);
    const contract = new ethers.Contract(address, abi, connectedWallet);

    return contract;
  } catch (error) {
    console.log(error);
  }
};

Contract ABI

No response

Errors

No response

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli)

Environment (Other)

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugVerified to be an issue.fixed/completeThis Bug is fixed or Enhancement is complete and published.v6Issues regarding v6

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions