node-metamask icon indicating copy to clipboard operation
node-metamask copied to clipboard

Metamask crashes after the connector starts

Open dbarasti opened this issue 4 years ago • 0 comments

I'm trying to authenticate transactions using metamask. I execute the following code but once I connect to page localhost:3333, MetaMask plugin crashes. It tries to show me the transaction notification but then goes blank.

async function connectToMetamask() {
  const connector = new MetaMaskConnector({
    port: 3333,
    onConnect() {
      console.log('MetaMask client connected')
    },
  });

  // Now go to http://localhost:3333 in your MetaMask enabled web browser.
  console.log("Go to http://localhost:3333");
  await connector.start();
  const web3 = new Web3(connector.getProvider());
  // Use web3 as you would normally do. Sign transactions in the browser.
  CampaignContract.setProvider(connector.getProvider());
}

Screenshot from 2020-06-19 12-10-59

dbarasti avatar Jun 19 '20 10:06 dbarasti