walletconnect-monorepo icon indicating copy to clipboard operation
walletconnect-monorepo copied to clipboard

Sign Client initialization failed

Open abdulhaseeb4239 opened this issue 2 years ago • 0 comments

Describe the bug I am working on integrating wallet connect in react-native app. I have a poc web-app in order to connect with mobile app, that I am running on localhost. I am getting error while initialising the sign client like this

const createClient = useCallback(async () => {
    try {
      setIsInitializing(true);
      const _client = await Client.init({
        logger: DEFAULT_LOGGER,
        relayUrl: DEFAULT_RELAY_URL,
        projectId: DEFAULT_PROJECT_ID,
        metadata: getAppMetadata() || DEFAULT_APP_METADATA,
      });

      console.log("CREATED CLIENT: ", _client);
      setClient(_client);
      await _subscribeToEvents(_client);
      await _checkPersistedState(_client);
    } catch (err) {
      throw err;
    } finally {
      setIsInitializing(false);
    }
  }, [_checkPersistedState, _subscribeToEvents]);

I am getting this error

ws.ts:102 WebSocket connection to 'wss://relay.walletconnect.com/?env=browser&host=localhost%3A3000&projectId=a450e71d8320703f06157f0ce4e7188a&protocol=wc&version=2' failed: 
error.ts:66 Uncaught TypeError: Cannot read properties of undefined (reading 'message')
    at parseConnectionError (error.ts:66:1)
    at WsConnection.parseError (ws.ts:148:1)
    at socket.onerror (ws.ts:108:1)

Wallet connect version

"@walletconnect/legacy-modal": "2.0.0-beta.101", "@walletconnect/sign-client": "2.0.0-beta.101", "@walletconnect/types": "2.0.0-beta.101", "@walletconnect/utils": "2.0.0-beta.101",

abdulhaseeb4239 avatar Sep 22 '22 12:09 abdulhaseeb4239