metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

Internal Error : {"code": -32603, "message": "Internal error"}

Open jobinabraham opened this issue 3 years ago • 13 comments

Describe the bug

Hey Community...Trying to migrate Walletconnect v1 react-native dapp implementation to walletconnect v2 in my react-native application. When trying to migrate "sendTransation" call from V1 to "provider.request" in V2, getting JSON-RPC error from metamask. The v1 version is working correctly so I am assuming its not an issue with metamask. No params have changed just the function. It seems the maxFee and maxPriorityFee are not being considered. Please help me out. `import { WalletConnectModal, useWalletConnectModal, } from '@walletconnect/modal-react-native'; const connector = useWalletConnectModal();

//----------V1 Version start--------------------// connector.sendTransaction({ data: encodedData, from: account, to: tokenAddress, nonce, maxFee: 1573479400382, maxPriorityFee: 115446958670, }) //----------V1 Version End--------------------// //----------V2 Version Start------------------// connector?.provider ?.request({ method: 'eth_sendTransaction', params: [{ data: encodedData, from: account, to: tokenAddress, nonce, maxFee: 1573479400382, maxPriorityFee: 115446958670, }, ], }) //----------V2 Version End--------------------//

Error from Metamask: {"code": -32603, "message": "Internal error"}`

WalletConnect Modal SDK version 1.0.0-rc.2

Screenshots Screenshot_20230626-190946_MetaMask (1) Screenshot_20230626-190959_MetaMask (1)

Expected behavior Transaction should successfully complete

Smartphone (please complete the following information):

  • Device: [e.g. OnePlus]
  • OS: Android
  • App Version : 7.10

to be added after bug submission by internal support / PM Severity Very critical

jobinabraham avatar Jun 28 '23 07:06 jobinabraham

Screenshot_2023-06-28-12-39-33-36_3ce871bb60cb313382b75690e63e41d0 Screenshot_2023-06-28-12-39-27-56_3ce871bb60cb313382b75690e63e41d0

jobinabraham avatar Jun 28 '23 07:06 jobinabraham

@anaamolnar Please check this. Would be grateful for some help around this

jobinabraham avatar Jun 28 '23 08:06 jobinabraham

Hit the same issue. When calling signTypedData with wc2 on MetaMask Android 7.1.0 dapp logs produce {"code": -32603, "message": "Internal error"} and metamask opens but does not open signin modal. MetaMask Android 7.0.1 worked fine.

hixus avatar Jun 29 '23 07:06 hixus

I'm getting the same error using WCv2 on MetaMask Android 7.1.0. I on zkSync Era testnet. I am trying to interact with a smart contract, I have tried sending the transaction by using the contract method and by sending an encoded transaction. In both case I am using customData to send the transaction using a Paymaster. The transaction is sent without problem when connecting using Metamask desktop extension.

equalogix avatar Jul 05 '23 15:07 equalogix

Getting the same error when using metamask and calling this const typedSignature = await web3Provider.send('eth_signTypedData', [address, JSON.stringify(typedData)]);

daniiba avatar Jul 06 '23 14:07 daniiba

Anything on this?

jobinabraham avatar Jul 11 '23 07:07 jobinabraham

So it seems that the issue is with WalletConnect not forwarding the error correctly. If you print the error to the page (html) and then open the app with the Metamask app browser and trigger the error, the full error message will be displayed on the page. Doing the same with the default browser using WalletConnect will print the internal error message only.

equalogix avatar Jul 11 '23 13:07 equalogix

The error that is causing this behavior for me is:

{
    "code":-32603,
    "message":"Provided chainId \"280\" must match the active chainId \"640\"",
    "data": {
        "originalError": {
           "line":3687,
           "column":1879,
           "sourceURL":"index.android.bundle"
       }
   }
}

To be clear, what this message is saying is that my "provided chain" is 280 "zkSync-era testnet" and it is not matching the active chain 640. The problem is that 640 is not an actual chain and certainly not a chain that I selected. 640 is the int value of hex 280 ie: parseInt('0x280') === 640. This suggests that somewhere in the code, the chainId was provided as int when it should have been a hex. But the error only occurs on mobile, both with and without WalletConnect, which suggests that it is Metamask bug.

Is the internal error issue with WalletConnect specific to this Metamask bug or is the WalletConnect issue generalized to a wide array of errors? The question to those affected is the error you are seeing similar to mine?

equalogix avatar Jul 11 '23 14:07 equalogix

@equalogix The error seems to be that somehow metamask is not able to read/calculate the proper gas limit. If I do initiate the transaction via WC->Metamask and manually alter the gas limit, the transaction goes through. So seems some issue with gas limit calculation maybe. Also, can you check if the maxFee & maxPriorityFee that I am sending are the correct parameters. Attaching the screen recording of the error on metamask mobile.

Following is the eth request I am seding. connector?.provider ?.request({ method: 'eth_sendTransaction', //[ params: [ { data: encodedData, from: account, to: tokenAddress, nonce, maxFee: 1573479400382, maxPriorityFee: 115446958670, }, ], // ], })

https://github.com/MetaMask/metamask-mobile/assets/9764162/6e6a974a-6234-4615-a84c-ed7acdc46239

jobinabraham avatar Jul 12 '23 06:07 jobinabraham

@equalogix The error seems to be that somehow metamask is not able to read/calculate the proper gas limit. If I do initiate the transaction via WC->Metamask and manually alter the gas limit, the transaction goes through. So seems some issue with gas limit calculation maybe. Also, can you check if the maxFee & maxPriorityFee that I am sending are the correct parameters. Attaching the screen recording of the error on metamask mobile.

Following is the eth request I am seding. connector?.provider ?.request({ method: 'eth_sendTransaction', //[ params: [ { data: encodedData, from: account, to: tokenAddress, nonce, maxFee: 1573479400382, maxPriorityFee: 115446958670, }, ], // ], })

d46c8b84-b528-47fb-a80e-f43bce645503.mp4

My problem was solved with the latest version Metamask (7.2.0), but the issue that remains pertains to WalletConnect, where the error messages isn't being passed through, the only message one gets is internal error.

As to your question about gas fees, I think this article may be helpful for you. https://docs.alchemy.com/docs/maxpriorityfeepergas-vs-maxfeepergas

equalogix avatar Jul 12 '23 14:07 equalogix

i'm using web3.js with metamask mobile app, but failed to call both call and send method.. it return -32603 code error...

but on desktop browser working fine.... what actually the problem is?

syamsoul avatar Aug 23 '23 13:08 syamsoul

This issue has been automatically marked as stale because it has not had recent activity in the last 90 days. It will be closed in 7 days. Thank you for your contributions.

github-actions[bot] avatar Nov 21 '23 14:11 github-actions[bot]

This issue was closed because there has been no follow activity in 7 days. If you feel this was closed in error please provide evidence on the current production app in a new issue or comment in the existing issue to a maintainer. Thank you for your contributions.

github-actions[bot] avatar Nov 28 '23 15:11 github-actions[bot]