Transaction failed - gas required exceeds allowance (1812)

When asking for help in this category, please make sure to provide the following details:

I cannot transfer ether by ethers but successfully in dialog

const sendTransaction = async (provider: IProvider): Promise => {
try {
const ethersProvider = new ethers.BrowserProvider(provider);
const signer = await ethersProvider.getSigner();

const destination = "0x40e1c367Eca34250cAF1bc8330E9EddfD403fC56";

const amount = ethers.parseEther("0.001");

// Submit transaction to the blockchain
const tx = await signer.sendTransaction({
  to: destination,
  value: amount,
  maxPriorityFeePerGas: "15000000000", // Max priority fee per gas
  maxFeePerGas: "16000000000000", // Max fee per gas
});

// Wait for transaction to be mined
const receipt = await tx.wait();

return receipt;

} catch (error) {
return error as string;
}
}

[
{
"code": "CALL_EXCEPTION",
"action": "estimateGas",
"data": null,
"reason": null,
"transaction": {
"to": "0x3F3E152Dbd359060Dda0BB53cC15Be9d9cFB2bc3",
"data": "0x",
"from": "0x1fB58a643cbCf17BCE03fCf283FB19Af6e1Bfdd1"
},
"invocation": null,
"revert": null,
"shortMessage": "missing revert data",
"info": {
"error": {
"code": -32603,
"data": {
"code": -32000,
"message": "gas required exceeds allowance (1812)",
"cause": null
},
"message": "Internal JSON-RPC error."
},
"payload": {
"method": "eth_estimateGas",
"params": [
{
"maxFeePerGas": "0xe8d4a510000",
"maxPriorityFeePerGas": "0x37e11d600",
"value": "0x38d7ea4c68000",
"from": "0x1fb58a643cbcf17bce03fcf283fb19af6e1bfdd1",
"to": "0x3f3e152dbd359060dda0bb53cc15be9d9cfb2bc3"
}
],
"id": 5,
"jsonrpc": "2.0"
}
}
}
]

  • SDK Version(package.json):
  • Platform:
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name: CP25Custom-test
    • JWKS Endpoint:
    • Sample idToken (JWT): Email

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

Hey @kenneth.hu.tw, one of the reason you might get this issue is because of gas being not sufficient. Looking from the snippet, you are hardcoding the gas. Also, in the error logs, the transaction data seems to be different than one you are shared in the code snippet.

Can you dynamically estimate the required gas, and try. If possible, can you share me the signed transaction, which is being broadcasted to the network?