InfuraProvider throws an Error
See original GitHub issueI’m attempting to use the InfuraProvider
to connect to the ropsten
network but I get an error when doing so.
Doing this
const provider = new InfuraProvider(
"ropsten",
"780797e7832148289ef283af4ade0a58"
);
provider.getBlockNumber().then(console.log);
results in the following error:
index.js:165 Uncaught (in promise) Error: missing response (serverError={}, url="https://ropsten.infura.io/v3/780797e7832148289ef283af4ade0a58", code=SERVER_ERROR, version=web/5.0.0-beta.141)
at Logger.makeError (index.js:165)
at Logger.throwError (index.js:174)
at index.js:100
at Generator.throw (<anonymous>)
at rejected (index.js:6)
As a sanity check using I made sure I could access the Infura endpoint with my project id using curl
which works
curl -X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \
"https://ropsten.infura.io/v3/780797e7832148289ef283af4ade0a58"
Note: Infura project ID is a throw-away that will be deleted once this is resolved 😃
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:14 (5 by maintainers)
Top Results From Across the Web
How to handle wrong chain error [Infura, Wagmi, React ...
InfuraProvider (chainId, infuraId); const chains: Chain[] ... Everything is working correctly, that error just gets thrown when I run the app ...
Read more >Using Infura (or a custom provider) - Truffle Suite
This tutorial will show you how to use Infura to migrate an existing dapp to an Ethereum network supported by Infura. In this...
Read more >could not detect network (event="noNetwork", code - You.com
I am currently following the step by step video guide and stumbled on this issue regarding the json-rpc-provider. Has anyone been able to...
Read more >Configuring Chains - wagmi
If a provider does not support a chain, it will fall back onto the next one in the array. If no RPC URLs...
Read more >node.js - Is there an issue with the Infura provider project ID or ...
js part, the code executes through console logging the mnemonic and address, and then throws the below error. UnhandledPromiseRejectionWarning: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My lines of code const network = “mainnet”; const provider = new ethers.providers.InfuraProvider(network, { projectId: “c3db272c665f70df0d9”, projectSecret: “1b326380e58328ea6” });
const getBalanceAsync = async (address) => { let rawBalance = await provider.getBalance(address); return (rawBalance); }
This is the response i get when i want to fetch balance using Infura. Please what is wrong
[Unhandled promise rejection: Error: bad response (status=400, headers={“vary”:“Origin”,“content-type”:“application/json”,“date”:“Tue, 08 Jun 2021 15:01:22 GMT”,“content-length”:“74”}, body=“{"jsonrpc":"2.0","error":{"code":-32600,"message":"invalid json request"}}”, requestBody=“{"method":"eth_getBalance","params":["0x77ab999d1e9f152156b4411e1f3e2a42dab8cd6d","latest"],"id":42,"jsonrpc":"2.0"}”, requestMethod=“POST”, url=“https://mainnet.infura.io/v3/c3db1af154164**************9”, code=SERVER_ERROR, version=web/5.3.0)]