0

I am getting this error when i trying to use metamask on my gancache local for a simple transaction Metamask is connected to my ganache this is the erreur enter image description here

and this is how i called my methode

packItem: function (event) {
    event.preventDefault();
    var processId = parseInt($(event.target).data('id'));

    App.contracts.SupplyChain.deployed().then(function (instance) {
        return instance.packItem(App.upc, { from: App.metamaskAccountID });
    }).then(function (result) {
        $("#ftc-item").text(result);
        console.log('packItem', result);
    }).catch(function (err) {
        console.log(err.message);
    });
},
3
  • Looks like the smart contract is returning an error?
    – yangli-io
    Jul 8 '21 at 16:22
  • @yangli-io no it's a metmask erreur , i run a test for my smart contract and everything works fine
    – Rami fahd
    Jul 9 '21 at 0:08
  • Are you authenticating from metamask before calling any method? Look like you have multiple account in metamask and stuck with wrong authentication Jul 9 '21 at 2:38
0

You are using the wrong account to access "this item". this has nothing to do with Metamask or any code error.

you simply don't have the rights for a specific item on the smart contract you are calling and the contract is reverting the transaction with the error you are seeing.

It looks like a code error because web3 or the lib you are using, handles all transaction errors the same, whether it's underfunding or bad data or general assertions in the smart contract, all the same way.

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.