Error on disconnecting from WalletConnect client

I’m getting the following error when disconnecting from WalletConnect client after authenticating using moralis (1.1.2), react-moralis (1.1.0), and @walletconnect/web3-provider (1.7.1)

How I’m authenticating…
() => authenticate({ provider: "walletconnect" })

Error I’m seeing…

Uncaught (in promise) Error: Missing or invalid topic field
    at SocketTransport.send (index.ts:107)
    at WalletConnect._sendRequest (index.ts:799)
    at async WalletConnect.killSession (index.ts:609)
    at async WalletConnectProvider.close (index.ts:143)

I didn’t have this problem when using @walletconnect/client and @walletconnect/qrcode-modal where I would just listen for the ‘disconnect’ event to log them out properly. I searched around, but I don’t seem to have access to such event listeners. Has anyone experienced this issue and if so, how can I fix it?

1 Like

@tealeaf28 Unfortunately I experienced the same with [email protected] [email protected] and @walletconnect/[email protected].

Would be great to handle this nicer and perform a Moralis logout.

Maybe this issue is related just testing.

@tealeaf28 I solved by listening to Moralis.onWeb3Deactivated event then call Moralis.User.logOut progmatically as guessed above.

The Missing or invalid topic field error is fixed in v1.2.5

Also in order to listen to the disconnect event. you can use
Moralis.onDisconnect (see

It depends if the provider has this event implemented correctly, as far as I know this is the case with walletconnect.