1

anyone else who tries to read smart contract data through Infura and process it on front-end but gets 'CORS' error? My DAPP works fine in Google Chrome and has no issue in fetching the smart contract data. Same on Internet Explorer. The problem is when I use Microsoft Edge that I'm getting this:

Microsoft Edge Error

My web3 implementation is correct:

import Web3 from 'web3';


let web3;
if (typeof window !== 'undefined' && typeof window.web3 !== 'undefined') {
  // metamask is running
  web3 = new Web3(window.web3.currentProvider);
} else {
  // set up provider through infura
  const provider = new Web3.providers.HttpProvider(
    // pass url of remote node
    'https://rinkeby.infura.io/v3/censored');
  web3 = new Web3(provider);

}

export default web3;
1

I FOUND THE SOLUTION! I was running web3@1.0.0-beta.35 however downgrading to web3@1.0.0-beta.34 fixed it for me.

All credits go to clementbalestrat

  • happy to hear that,please don't forget to accept your own answer. – Badr Bellaj Oct 13 '18 at 16:18
0

One possibility is that your computer is configured with an Intranet zone and that Intranet zone is dependent on a proxy configuration script: http://blogs.msdn.com/b/ieinternals/archive/2012/06/05/the-local-intranet-security-zone.aspx. When Fiddler is running, the proxy settings are pointed at Fiddler itself.

Ah, right, there's another factor at work here if you're using an Intranet site as the target of an XHR from a site in the Internet zone.

Edge runs in Enhanced Protected Mode (AppContainer). That has a feature which blocks access to Private Network Resources from Internet-Zone processes. See the "Private Network resources" section of http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx for more details.

Source: https://blogs.msdn.microsoft.com/ieinternals/2012/03/23/understanding-enhanced-protected-mode/

  • What bothers me is that it worked for weeks and now out of nowhere it stopped. I'm considering setting it up through a proxy but I still want to see if others have any solutions – Cristian Oct 13 '18 at 14:37
0

If you'd like to avoid downgrading, the most-recent pre-release of Web3 also solves the problem. npm i web3@2.0.0-alpha.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.