react-auth-box icon indicating copy to clipboard operation
react-auth-box copied to clipboard

Fetching Web3 init on main thread

Open rstormsf opened this issue 7 years ago • 2 comments

If I try to get Web3 object not using Redux store, it works perfectly fine and I don't get any errors: if I use it with 'https://ropsten.infura.io/metamask' I cannot initialize it, I get errors, 405 POST , Invalid JSON rpc response I assume it has something to do with the way web3 is being fetched. I guess Redux store is trying to use it on main thread and for some reason is not ok to do this way. httpprovider.js:61 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated

The same thing happens when I just run this repo with metamask. It breaks initialization of web3.

Error: Invalid JSON RPC response: {"id":1,"jsonrpc":"2.0"} 

rstormsf avatar Jul 16 '17 23:07 rstormsf

It could be because of onLoad event listener which is called by any import function. https://github.com/truffle-box/react-auth-box/blob/master/src/util/web3/getWeb3.js#L14

rstormsf avatar Jul 17 '17 01:07 rstormsf

By digging more into it, I found that Chrome Redux extension breaks the calls. If I disable it, everything works just fine.

rstormsf avatar Jul 17 '17 19:07 rstormsf