could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.0.5) in React Native Expo
See original GitHub issueHere is my code being used for testing. It works in a small node program but will not work in React Native.
import "@ethersproject/shims";
import { ethers } from "ethers";
const NodeAddress = "http://34.87.222.10:8545";
// ....
useEffect(() => {
(async () => {
try {
let p = await ethers.providers.getDefaultProvider(NodeAddress);
await p._networkPromise;
console.log(p);
} catch (e) {
console.log(e);
}
})();
}, []);
// ....
Issue Analytics
- State:
- Created 3 years ago
- Comments:22 (7 by maintainers)
Top Results From Across the Web
could not detect network (event="noNetwork", code ... - GitHub
Here is my code being used for testing. It works in a small node program but will not work in React Native. import...
Read more >Error: could not detect network (event="noNetwork", code ...
I want to connect to ganache and I get ...
Read more >error: could not detect network (event=nonetwork, code ...
I'm running a test contract on ETH. I Run :npx hardhat run scripts/deploy.js --network goerli. it ...
Read more >NetInfo - React Native
Detect if the current active connection is metered or not. A network is classified as metered when the user is sensitive to heavy...
Read more >@react-native-community/netinfo - npm
React Native Network Info API for iOS & Android. Latest version: 9.3.7, last published: a month ago.
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
Strangely,react native does not work with the current version of ethers library but it works fine with ethers version 5.0.5 and lower
I think there may be. Depending on your setup (again, if you are using a proxy, things might further be affected), but you might want to adjust the network device to be any (I think you do this by specifying
0.0.0.0
) and you might need to add the CORS origin flag to allow any (I don’t know the key or value to set for this).If it is using CORS, make sure your Proxy is set up to forward
OPTIONS
too.Setting up a link is definitely non-trivial…