# \[Archive\] Error: Internal JSON-RPC error

**URL:** <https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [March 28, 2023, 9:34am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872 "2023-03-28T09:34:56Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![yajassardana1](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yajassardana1](https://builder.metamask.io/u/yajassardana1)\
**Post date:** [March 28, 2023, 9:34am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/1 "2023-03-28T09:34:56Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **yajassardana1** on 3/28/2023.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

I’m getting the following error:

```auto
Error: Internal JSON-RPC error.
    at getEthJsonRpcError (errors.js?b80e:118:1)
    at Object.internal (errors.js?b80e:28:1)
    at provider.sendAsync (baseControllers.esm.js?d94b:447:13)
    at async provider.request (baseControllers.esm.js?d94b:469:1)

```

Product UseCase: I’m using gelato relay with web3auth and gnosis safe to create a flow to buy NFTs using credit cards.

**Issue** being faced: My flow requires calling the “approve” function on an ERC-20 token, namely USD Coin(PoS) on the polygon Mumbai testnet. More details about the token are as follows: [USD Coin (PoS) (USDC) Token Tracker | PolygonScan](https://mumbai.polygonscan.com/token/0x0FA8781a83E46826621b3BC094Ea2A0212e71B23?a=0xd397c7C9dE1f32A3Be31f7EEC9e492504b9dD31D)

However, this contract involves a proxy implementation, which means that many functions like approve have been written in another underlying contract, and function calls are delegated to that contract.

Coming to the issue being faced: Whenever I’m calling any write functions, like `approve`, on this token using my web3auth signer, I’m getting the mentioned Internal JSON-RPC error.

**However,** this error is not being faced if I login on web3auth using metamask. This error only arises when I login using a method that comprises of an EOA being created by Web3auth.

Also note that:

1. All types of calls on simple non-proxy contracts are working perfectly.
2. Read calls like `balanceOf` are also working fine, regardless of the login method.

My hunch is that web3auth EOAs are facing an error in gas limit estimation or function calling for proxy contracts.

I have a project submission tomorrow, and am thus running on a crunched timeline. Looking forward to a resolution asap @shahbaz @yashovardhan

- SDK Version: web3auth/modal": “4.2.3”
- Platform: Web - Chrome
- Browser Console Screenshots:  

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/f/f3090ece2e40074927da8d4a672f2d297345f19a.png)
image894×156 29 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/6791892c4f9cda854e02fb08a485e0997f6fbdc7.png "image")

**Please provide the Web3Auth initialization and login code snippet below:**  
I’m using **Gelato’s** gasless wallet SDK, which has an integration of web3auth web modal in it.

```auto
const gaslessWalletConfig = { apiKey: process.env.NEXT_PUBLIC_GASLESSWALLET_KEY};
      const loginConfig = {
        domains: ["http://localhost:3000/"],
        chain : {
          id: 80001,
          rpcUrl: "https://wiser-alien-morning.matic-testnet.discover.quiknode.pro/c2f6cfc05517853e094ad7ea47188326625f20b5/",
        },
        openLogin: {
          redirectUrl: `http://localhost:3000/`,
        },
      };
      const gaslessOnboarding = new GaslessOnboarding(
        loginConfig,
        gaslessWalletConfig
      );
  await gaslessOnboarding.init();
  const web3AP = await gaslessOnboarding.login();
  setWeb3AuthProvider(web3AP);

```

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [March 28, 2023, 11:38am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/2 "2023-03-28T11:38:29Z")

</div>

Hey @yajassardana1

Have you tried passing a different rpcUrl endpoint? And what happens if you don’t pass the rpcUrl?

---

<div class="post-metadata">

**Author:** ![yajassardana1](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yajassardana1](https://builder.metamask.io/u/yajassardana1)\
**Post date:** [March 28, 2023, 12:18pm UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/3 "2023-03-28T12:18:53Z")

</div>

Hello @shahbaz, this rpcURL is one that I’ve created using my quicknode account.

I tried passing other rpcURLs and faced the same issue.

Also, rpcURL is a required parameter here, so not passing it gives an error in initializing the modal.

**Furthermore** , if I login on the modal using metamask, its working completely fine. Its the other methods which are producing this error.

---

<div class="post-metadata">

**Author:** ![yajassardana1](https://avatars.discourse-cdn.com/v4/letter/y/e56c9b/32.png) [@yajassardana1](https://builder.metamask.io/u/yajassardana1)\
**Post date:** [March 29, 2023, 6:12am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/4 "2023-03-29T06:12:00Z")

</div>

Any updates @shahbaz @yashovardhan ?

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [March 30, 2023, 5:14am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/5 "2023-03-30T05:14:22Z")

</div>

Which SDK is this? And what’s GaslessOnboarding?

---

<div class="post-metadata">

**Author:** ![arpita](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@arpita](https://builder.metamask.io/u/arpita)\
**Post date:** [April 29, 2023, 1:57pm UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/6 "2023-04-29T13:57:26Z")

</div>

@shahbaz i get the same error when doing a send call on smart contract.  
`this.web3auth = new Web3Auth({ clientId: envVars.web3ClientId, chainConfig: { chainNamespace: 'eip155', chainId: '0x13881', // hex of 80001, polygon testnet rpcTarget: 'https://rpc.ankr.com/polygon_mumbai', displayName: 'Polygon Mumbai Testnet', blockExplorer: 'https://mumbai.polygonscan.com/', ticker: 'MATIC', tickerName: 'Matic', }, uiConfig: { theme: 'light', loginMethodsOrder: ['facebook', 'google', 'twitter'], defaultLanguage: 'en', appLogo: '', // Your App Logo Here }, web3AuthNetwork: 'testnet', });`

this is my config

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [May 2, 2023, 10:18am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/7 "2023-05-02T10:18:35Z")

</div>

Hey @arpita

When accessing `https://rpc.ankr.com/polygon_mumbai`, it is important to note that the endpoint can become congested. To reduce this issue, consider utilizing a custom RPC provider from Infura, QuickNode, Alchemy, or other similar services.

---

<div class="post-metadata">

**Author:** ![ionut.paicu](https://avatars.discourse-cdn.com/v4/letter/i/34f0e0/32.png) [@ionut.paicu](https://builder.metamask.io/u/ionut.paicu)\
**Post date:** [July 5, 2023, 11:20am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/8 "2023-07-05T11:20:57Z")

</div>

Any updates on this issue?

---

<div class="post-metadata">

**Author:** ![chrispinto2197](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/chrispinto2197/32/317_2.png) [@chrispinto2197](https://builder.metamask.io/u/chrispinto2197)\
**Post date:** [July 18, 2023, 7:47am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/9 "2023-07-18T07:47:42Z")

</div>

I noticed a similar issue in my code.

Create a contract

```auto
    const contract = new ethers.Contract(
        contractAddress,
        contractAbi,
        signer
      );

```

Calling a method

```auto
        const res = await contract.buyTicket(
          quantity,
          referral,
          username,
          signature,
          {
            gasLimit: 1500000,
          }
        );

```

This works perfectly with Metamask  
However, when I connect with a Social login - Google, it fails saying

```auto
Error: Internal JSON-RPC error.
    at getEthJsonRpcError (errors.js:118:1)
    at Object.internal (errors.js:28:1)
    at provider.sendAsync (baseControllers.esm.js:443:13)
    at async provider.request (baseControllers.esm.js:465:1)

```

This does not reach or reflect on the blockchain

If I remove the gasLimit override  
The transaction reaches the blockchain but fails as gasLimit is exceeded

```auto
Gas Limit & Usage by Txn:

```

Gas Limit does not accept a **custom value higher than 100000 with Web3Auth social**

But I need to set a high limit for my function call.

Is there anything I can do here?  
@shahbaz  
@chai  
@archit

Thanks

---

<div class="post-metadata">

**Author:** ![chai](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chai](https://builder.metamask.io/u/chai)\
**Post date:** [July 19, 2023, 11:58am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/10 "2023-07-19T11:58:59Z")

</div>

Pls specify the value to override as `gas` and not `gasLimit`

example:

```auto
const res = await contract.buyTicket(
          quantity,
          referral,
          username,
          signature,
          {
            gas: 1500000,
          }
        );

```

---

<div class="post-metadata">

**Author:** ![chrispinto2197](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/chrispinto2197/32/317_2.png) [@chrispinto2197](https://builder.metamask.io/u/chrispinto2197)\
**Post date:** [July 20, 2023, 6:51am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/11 "2023-07-20T06:51:31Z")

</div>

No luck,  
Got this in my console

```auto
Error: cannot override "gas" (operation="overrides", overrides=["gas"], code=UNSUPPORTED_OPERATION, version=contracts/5.7.0)
    at Logger.makeError (index.js:224:1)
    at Logger.throwError (index.js:233:1)
    at eval (index.js:207:1)
    at Generator.next (<anonymous>)
    at fulfilled (index.js:5:43)

```

[Ethers Docs](https://docs.ethers.org/v5/api/contract/contract/#contract-functionsSend)

---

<div class="post-metadata">

**Author:** ![chai](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chai](https://builder.metamask.io/u/chai)\
**Post date:** [July 21, 2023, 8:14am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/12 "2023-07-21T08:14:00Z")

</div>

Fixed this and released 6.1.5

---

<div class="post-metadata">

**Author:** ![chrispinto2197](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/chrispinto2197/32/317_2.png) [@chrispinto2197](https://builder.metamask.io/u/chrispinto2197)\
**Post date:** [July 24, 2023, 6:15am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/13 "2023-07-24T06:15:14Z")

</div>

Thanks @chai ,  
I see it reflected on GitHub, however, can you publish it to npm as it still shows 6.1.4

[NPM](https://www.npmjs.com/package/@web3auth/no-modal?activeTab=versions)

---

<div class="post-metadata">

**Author:** ![chai](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chai](https://builder.metamask.io/u/chai)\
**Post date:** [July 24, 2023, 6:34am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/14 "2023-07-24T06:34:57Z")

</div>

Not all sub packages are published for 6.1.5.  
Only wallet-connect-v2-adapter, ethereum-provider, ui, modal packages are required to be updated

---

<div class="post-metadata">

**Author:** ![chrispinto2197](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/chrispinto2197/32/317_2.png) [@chrispinto2197](https://builder.metamask.io/u/chrispinto2197)\
**Post date:** [July 24, 2023, 7:50am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/15 "2023-07-24T07:50:03Z")

</div>

Packages I use include:  
“@web3auth/base”,  
“@web3auth/coinbase-adapter”,  
“@web3auth/metamask-adapter”,  
“@web3auth/no-modal”,  
“@web3auth/openlogin-adapter”,  
“@web3auth/torus-evm-adapter”,  
“@web3auth/torus-wallet-connector-plugin”,  
“@web3auth/wallet-connect-v2-adapter”,

Which would mean only wallet-connect-v2-adapter gets updated right? @chai

---

<div class="post-metadata">

**Author:** ![chai](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chai](https://builder.metamask.io/u/chai)\
**Post date:** [July 24, 2023, 8:08am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/16 "2023-07-24T08:08:23Z")

</div>

I see…in your case, gelato has to upgrade the modal sdk in their package.  
You can contact them to do it

---

<div class="post-metadata">

**Author:** ![chrispinto2197](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/chrispinto2197/32/317_2.png) [@chrispinto2197](https://builder.metamask.io/u/chrispinto2197)\
**Post date:** [July 24, 2023, 9:22am UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/17 "2023-07-24T09:22:09Z")

</div>

Hi @chai  
I am not using any gelato package in my application  
But had a similar issue with setting a custom gas limit

---

<div class="post-metadata">

**Author:** ![chai](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@chai](https://builder.metamask.io/u/chai)\
**Post date:** [July 24, 2023, 2:00pm UTC](https://builder.metamask.io/t/archive-error-internal-json-rpc-error/1872/18 "2023-07-24T14:00:52Z")

</div>

pls upgrade and it should just work then
