question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Signed transaction fails to send via MetaMask

See original GitHub issue

I am able to use ethers to read information from a deployed contract via the MetaMask provider (with a contract object created using the Signer object via provider with new ethers.providers.Web3Provider(window.ethereum) after connecting Metamask, so it should have write permissions), however for sending eth to that contract (or just sending eth to a regular account) MetaMask does not prompt the user for confirmation – it simply throws the following error:

{
  "code": -32016,
  "message": "The execution failed due to an exception.",
  "data": "Reverted"
}

I am able to successfully send eth to the contract via the web3 provider directly, but it’s nicer to do it from the contract object from ethers.js. What could be the issue? I am certain that web3 and metamask are working correctly, the error only happens when trying to call the contract function directly from the ethers contract object.

Also tried running unit tests on the same code used via Metamask (the contract calling function), but via Hardhat, and it passes – so the issue must be somewhere between ethers and metamask?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rellfycommented, Feb 25, 2021

This must have been some error with my MetaMask client. I was able to get it working from a minimal example yesterday, and now the error is gone from the main project. Oh well. Thanks for responding!

0reactions
leojacob1commented, Mar 4, 2022

This is happening to me! Do you have any idea how you fixed it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Failed Transaction Error on MetaMask - Saint
How to Fix Failed Transaction Error on MetaMask · 1. Restart Your Device. · 2. Connect Your Wallet First. · 3. Re-Login Your...
Read more >
Charged for Failed Transactions? - MetaMask community
When transactions fail, a notification does appear on your MetaMask wallet, along with it showing in the Activity section of your wallet. The ......
Read more >
Metamask Errors | How to Fix Them | by KoffeeSwap - Medium
This error can be caused by many different issues, such as the developer of the token not allowing transactions, or your specific wallet...
Read more >
Understanding and resolving MetaMask error codes
This error could be a result of many things. It could be because the sender's address doesn't exist, insufficient funds, the account is...
Read more >
METAMASK FAILED TRANSACTION ERROR RESOLVED!
METAMASK FAILED TRANSACTION ERROR RESOLVED!BECOME A PATREON: https://www.patreon.com/cryptobull(Patreon benefits: Private Chat, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found