# \[Archive\] Error: urilib.resolve is not a function

**URL:** <https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [August 30, 2023, 5:58pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804 "2023-08-30T17:58:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [August 30, 2023, 5:58pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/1 "2023-08-30T17:58:43Z")

</div>

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

* * *

Hello,

I am trying to use signed typed data. But when I am doing the signature I am getting the following error:

```auto
Error: urilib.resolve is not a function
    at getJsonRpcError (errors.js:176:1)
    at Object.internal (errors.js:42:1)
    at provider.sendAsync (openloginJrpc.esm.js:686:22)
    at async provider.request (openloginJrpc.esm.js:708:1)

```

I am using the following code:

```auto
const originalMessage = {
        types: {
          EIP712Domain: [
            {
              name: "name",
              type: "string",
            },
            {
              name: "version",
              type: "string",
            },
            {
              name: "verifyingContract",
              type: "address",
            },
          ],
          Greeting: [
            {
              name: "contents",
              type: "string",
            },
          ],
        },
        primaryType: "Greeting",
        domain: {
          name: "web3auth",
          version: "1",
          verifyingContract: "0xE0cef4417a772512E6C95cEf366403839b0D6D6D",
        },
        message: {
          contents: "Hello, from Web3Auth!",
        },
      };
      const params = [maker, originalMessage];
      const method = "eth_signTypedData_v4";
      const sigBytes = await signer.provider.send(method, params);

```

Do you have an idea where it could come from ? Maybe I missed something.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![vjgee](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vjgee](https://builder.metamask.io/u/vjgee)\
**Post date:** [September 2, 2023, 10:49am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/2 "2023-09-02T10:49:56Z")

</div>

@guillaume Thanks for reaching out.

Your issue has been forwarded to our Dev team and we will get back with further updates once more information becomes available.

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 7:03am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/3 "2023-09-04T07:03:00Z")

</div>

Thank you.

To provide you with more details. I tried many differents approches and this one is happening with ethers v5. Even in your exemple bundle there is the exact same error with ethers v5.

Waiting for your dev team answer.

Regards.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 7:17am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/4 "2023-09-04T07:17:59Z")

</div>

@guillaume Sorry for the inconvenience. Could you please help with the example with this issue?

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 7:29am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/5 "2023-09-04T07:29:58Z")

</div>

If you git clone your [w3a-modal-evm-vue](https://github.com/Web3Auth/web3auth-pnp-examples/blob/main/web-modal-sdk/evm/vue-evm-modal-example/src/ethersRPC.ts) example repository.

And set `"ethers": "^5.6.5"` in your `package.json`

The following signing code would reproduce the error:

```auto
async signMessage() {
    try {
      // For ethers v5
      const ethersProvider = new ethers.providers.Web3Provider(this.provider);
      // const ethersProvider = new ethers.BrowserProvider(this.provider);
  const signer = await ethersProvider.getSigner();

  // Get user's Ethereum public address
  const fromAddress = await signer.getAddress();

  const originalMessage = {
    types: {
      EIP712Domain: [
        {
          name: "name",
          type: "string",
        },
        {
          name: "version",
          type: "string",
        },
        {
          name: "verifyingContract",
          type: "address",
        },
      ],
      Greeting: [
        {
          name: "contents",
          type: "string",
        },
      ],
    },
    primaryType: "Greeting",
    domain: {
      name: "web3auth",
      version: "1",
      verifyingContract: "0xE0cef4417a772512E6C95cEf366403839b0D6D6D",
    },
    message: {
      contents: "Hello, from Web3Auth!",
    },
  };
  const params = [fromAddress, originalMessage];
  const method = "eth_signTypedData_v4";
  
  const signedMessage = await signer.provider.send(method, params);      

  return signedMessage;
} catch (error) {
  console.log(error)
  return error as string;
}

```

And this code is coming from your [docs](https://web3auth.io/docs/connect-blockchain/ethereum/web#sign-typed-data-v4)

This is a runtime error. The compilation is ok.

Best regards.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 7:46am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/6 "2023-09-04T07:46:21Z")

</div>

Hi @guillaume, I tried out the given `signMessage` method with the vue-evm-modal example and I faced no issue whatsoever. I am curious did you run `npm install` after changing the ethers version? Or do you use yarn?

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 8:04am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/7 "2023-09-04T08:04:23Z")

</div>

@maharshi Yes I run `npm install` and I still face the same issue.

I am using npm versoin `8.19.2`

Do you know where it could come from ? Did you change the sign message method with v4 ? Because v1 signature is working for me but not v4.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 8:25am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/8 "2023-09-04T08:25:00Z")

</div>

@guillaume Have you tried removing the `node_modules` folder and the `package-lock.json` and running a fresh `npm install` ? Let me know if this resolves the issue for you. I am puzzled because I am not able to re-create this error on my side with the said example and replacing the `signMessage` code with the one you’ve mentioned.

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 8:39am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/9 "2023-09-04T08:39:14Z")

</div>

@maharshi Ok it is weird I tried all of this and I still have the same error. This is really a bottleneck for us because I am missing only this function to go live…

Did you think to change the import in [`Home.vue`](https://github.com/Web3Auth/web3auth-pnp-examples/blob/main/web-modal-sdk/evm/vue-evm-modal-example/src/Home.vue) L103 with ethers RPC ?

`import RPC from "./web3RPC";`

Should become:

import RPC from “./ethersRPC”;

And the repo is not working with v6 compilation fails… Though I am really stuck.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 8:59am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/10 "2023-09-04T08:59:56Z")

</div>

@guillaume Is the v6 ethers working for you or that also is throwing some errors?

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 9:06am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/11 "2023-09-04T09:06:48Z")

</div>

@maharshi v6 is not working. I opened an other [ticket](https://web3auth.io/community/t/ethersrpc-not-working-with-vuejs/5378) for that.

The [example](https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/web-modal-sdk/evm/vue-evm-modal-example) is working for you with v6 ?

You really need to change the import in `Home.vue` as said before so that you can reproduce the error.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 9:55am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/12 "2023-09-04T09:55:59Z")

</div>

Okay @guillaume. I got the error. Thanks a lot for pointing it out and keeping our examples up to date. I have resolved it. I have resolved the errors with the ethers v6. It is advisable to be on the latest version of ethers to prevent the exposure to vulnerabilities.  
I will be raising a PR for it and will let you know.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 9:58am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/13 "2023-09-04T09:58:31Z")

</div>

```
  <a href="https://github.com/Web3Auth/web3auth-pnp-examples/pull/543" target="_blank" rel="noopener">github.com/Web3Auth/web3auth-pnp-examples</a>

```

```
<div class="github-icon-container" title="Pull Request">
  <svg width="60" height="60" class="github-icon" viewBox="0 0 12 16" aria-hidden="true"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
</div>

```

```
  <h4>
    <a href="https://github.com/Web3Auth/web3auth-pnp-examples/pull/543" target="_blank" rel="noopener">fixed errors to vue-evm-modal</a>
  </h4>

<div class="branches">
  <code>Web3Auth:main</code> ← <code>Web3Auth:fix-vue-evm-modal</code>
</div>

  <div class="github-info">
    <div class="date">
      opened <span class="discourse-local-date" data-format="ll" data-date="2023-09-04" data-time="09:57:15" data-timezone="UTC">09:57AM - 04 Sep 23 UTC</span>
    </div>

    <div class="user">
      <a href="https://github.com/ihsraham" target="_blank" rel="noopener">
        <img alt="ihsraham" src="https://web3auth.io/community/uploads/default/original/2X/0/04afa650a26e9cf1c61da59b7e021eb5bac21136.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="595E60">
        ihsraham
      </a>
    </div>

    <div class="lines" title="1 commits changed 5 files with 1110 additions and 1130 deletions">
      <a href="https://github.com/Web3Auth/web3auth-pnp-examples/pull/543/files" target="_blank" rel="noopener">
        <span class="added">+1110</span>
        <span class="removed">-1130</span>
      </a>
    </div>
  </div>

```

Here’s the PR I have raised. You can take pull from the branch if you’re able to otherwise, I am working to get this merged ASAP.

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 12:06pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/14 "2023-09-04T12:06:45Z")

</div>

Thanks @maharshi for your reactivity !

Could be great as well to have it working with v5 to allow all projects to have it working… I am planning to move to v6 but I’d like to have it up and running with v5 as well…

Do you plan to fix it as well ?

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 12:15pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/15 "2023-09-04T12:15:26Z")

</div>

@maharshi It is working but know I have the same error with the v6 version:

```auto
[
{
"code": "UNKNOWN_ERROR",
"error": {
"code": -32603,
"message": "urilib.resolve is not a function"
},
"payload": {
"method": "eth_signTypedData_v4",
"params": [
"0x7759A924c4d19253C75511D9d4905B2bA443B5BA",
{
"types": {
"EIP712Domain": [
{
"name": "name",
"type": "string"
},
{
"name": "version",
"type": "string"
},
{
"name": "verifyingContract",
"type": "address"
}
],
"Greeting": [
{
"name": "contents",
"type": "string"
}
]
},
"primaryType": "Greeting",
"domain": {
"name": "web3auth",
"version": "1",
"verifyingContract": "0xE0cef4417a772512E6C95cEf366403839b0D6D6D"
},
"message": {
"contents": "Hello, from Web3Auth!"
}
}
],
"id": 4,
"jsonrpc": "2.0"
}
}
]

```

Could you try to resolve it ?

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 4, 2023, 2:11pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/16 "2023-09-04T14:11:39Z")

</div>

@guillaume I understand that this error is seen with the `signMessage` method pasted by you. But I am starting to believe that this is an issue with the method `signer.provider.send(method, params)` and nothing on the web3auth side. Advising you to refer their documentation for the methods that are used to sign a message or you could try using the way we have used in our examples. Let me know if this works for you.

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 4, 2023, 2:13pm UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/17 "2023-09-04T14:13:50Z")

</div>

@maharshi this is the way you provide in your docs as you can see: [SignedTypedV4](https://web3auth.io/docs/connect-blockchain/ethereum/web#sign-typed-data-v4)

I just change in the exemple to paste the signature from your docs.

Can you try on your side ?

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 5, 2023, 3:12am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/18 "2023-09-05T03:12:11Z")

</div>

Hi @guillaume, I have pushed another commit to the PR. All it needed was a polyfill for url. This fix will work for v5 as well.

---

<div class="post-metadata">

**Author:** ![guillaume](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@guillaume](https://builder.metamask.io/u/guillaume)\
**Post date:** [September 5, 2023, 7:18am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/19 "2023-09-05T07:18:43Z")

</div>

Hi @maharshi,

Looks nice, I’ll have a look, thanks for your reactivity !

Regards.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 6, 2023, 9:06am UTC](https://builder.metamask.io/t/archive-error-urilib-resolve-is-not-a-function/1804/20 "2023-09-06T09:06:21Z")

</div>

Will mark this thread as resolved.
