VM Exception while processing transaction: out of gas (when minting erc721 token)

Hello, when I try minting a ERC721 token (very similar to how its done in Rarible clone tutorial) I get the following error.

Error: Returned error: VM Exception while processing transaction: out of gas

It tried adding the gas limit to the ‘mintToken’ function such as
await window.tokenContract.methods.createItem(uri).send({from: window.ethereum.selectedAddress, gas: 1000000});

^This works and the token is minted, However it never asks for the user to sign the signature in metamask. It just mints it without the metamask sign dropdown ever appearing.

Not sure what the issue is. I am calling the the mint token within a call back (after axios post request returns, also this is in React).

1 Like

Hey @kedpak, hope you are ok.

You might want to check if your issue is already named into this guide, if not, please provide the code in the way explained in this guide, so we can review and solve it properly :face_with_monocle:
https://forum.moralis.io/t/faq-common-issues-how-to-get-help/237/3

Carlos Z

Fixed the issue. If anyone else has this issue and using React, make sure you check all async calls and everything runs in the correct order as intended. Seems like my tokenContract call was running before the web3.Contract was instantiated.

2 Likes