Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
Can't connect to Metamask from js

I am trying web3 and creating NFT by myself for learning. I could make my ethereum network and now connect js to Metamask.

<script type="text/javascript" src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"></script>
<script type='application/javascript'>
  var provider;
  var signer;
  var myAddress;

  // Connect to Metamask
  async function connectWallet() {
    provider = new ethers.providers.Web3Provider(window.ethereum, "any");
    await provider.send("eth_requestAccounts", []);
    signer = provider.getSigner();
    myAddress = await signer.getAddress();
    document.getElementById('connect-button').remove();
    document.getElementById('wallet-address').innerHTML = myAddress;
    document.getElementById('wallet-info').style.visibility = 'visible';
  }

</script>

It above returns error: ethers-5.2.umd.min.js:1 Uncaught (in promise) Error: missing provider (argument="provider", value=undefined, code=INVALID_ARGUMENT, version=providers/5.2.0). As far as I see, there is no other parameters to pass ethers.providers.Web3Provider and could not find people who have same error. What is wrong with me ? Any answers would be appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!