Unable to create Type Signed Message when use social login method

We’re experiencing an issue with @kapil.upwork :

While using social methods for login on our app with Web3Auth, I encountered some issues when trying to create createTypeSignedMessage. (Note: This error does not occur when using MetaMask.)

1. InternalRpcError: An internal error was received.
Details: Cannot read properties of null (reading ‘ok’) Version: viem@2.18.6 at AN.delay.count (index-BXZrYXCX.js:150:14308) at async o (index-BXZrYXCX.js:150:13829)
Caused by: Error: Cannot read properties of null (reading ‘ok’) at Dd (index-BXZrYXCX.js:105:107043) at Object.internal (index-BXZrYXCX.js:105:106381) at UD.t.sendAsync (index-BXZrYXCX.js:105:118466) at async UD.t.request (index-BXZrYXCX.js:105:118768) at async AN.delay.count (index-BXZrYXCX.js:150:14110) at async o (index-BXZrYXCX.js:150:13829)

2. Console Error: JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started).

Additionally, when trying to read data from the blockchain using contract.getCollectAmountByChallenge, the blockchain occasionally returns zero instead of the actual value.

We are using the latest SDK (version 8.12.0) for Web3Auth, wagmi@2.12.0, and and an Alchemy RPC URL: https://polygon-mainnet.g.alchemy.com/v2/${id}.

const domain = {
name: 'app_domain',
version: '1',
chainId: {polygonId}, // chain ID
verifyingContract: contractAddress,
};



const type = [
{ name: 'description', type: 'string' },
];



// Defined the data to be signed
const message = {
description: "String here",
};



const data = {
types: {
ChallengeInfo: type,
},
domain,
primaryType: 'ChallengeInfo',
message,
};



const signature = await signTypedDataAsync(data);
1 Like

Hey @marc.nahas

Please share the code of this function.

@shahbaz It a method from wagmi, Please check here useSignTypedData | Wagmi

I just used the same function inside a demo app, and it worked and returned the following:

@shahbaz Is this the example or demo app you are referring web3auth-pnp-examples/web-modal-sdk/wagmi-examples/wagmi-modal-example at main · Web3Auth/web3auth-pnp-examples · GitHub

Yes, I updated the demo to include the use of the ‘useSignTypedData’ function. Please fetch the latest example and do a clean install and test.

1 Like

@shahbaz Ok, Thanks. I will check this asap.

@shahbaz The example you provided is not working, throwing same error as in my application -

Please track data for signed string
Error for detailed error messages
IsError for if there is error while doing the process
const { signTypedData, data, error, isError } = useSignTypedData()
console.log('data, error, isError ', error, isError)

You can also try try with async method.

Here is screenshot from the same example!

@shahbaz Let me know if you interested in jump over a call for debuging

Not sure of the use case of this.

And from the screenshot, you can see the first line which is the value you get on calling the function.

I need the signature from the function execution, similar to your playground example. Here is the screenshot. When I console.log the “signTypeData” function, it only prints the function itself, not its return value. There are various use cases in for signed signature in our application.

Additionally, as I have mentioned multiple times, the bug only occurs when I sign in with social login. With MetaMask, it works correctly and returns a string. Please see the attached screenshot for reference 2.

Check in demo for sign personal message, It should return similar string.
https://demo.web3auth.io/app

Let’s schedule a debug session @kapil.upwork

@shahbaz Thanks. Please let me know what time you will be available.

@kapil.upwork @shahbaz Hi guys! I have the same problem. Do you have any solution?

@alexey.moiseenko They are going to provide an update by next week.

It’s fixed with the latest release, v12.2.3

Check out the following examples repo:

  1. with wagmi ( also check the polyfilling of url ) - Live Demo
  2. @web3auth/modal - Live Demo

Please confirm @kapil.upwork @alexey.moiseenko

Great! just checked and now it works! Thanks! @shahbaz :fist:

3 Likes

@shahbaz Thanks this feature is working. Although at starting I found that It stuck for few minutes. Seems working ok now.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.