WalletConnectFlutterV2 icon indicating copy to clipboard operation
WalletConnectFlutterV2 copied to clipboard

code: 4010, reason: Disconnecting for load balancing reasons

Open AmjadKhan2k18 opened this issue 1 year ago • 2 comments

I was trying to connect but there was no response I investigate and when this logs appear connect method worked and I got uri but

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (25169): │ #0   RelayClient._handleRelayClose (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:293:17)
relay_client.dart:293
I/flutter (25169): │ #1   RelayClient._createJsonRPCProvider.<anonymous closure> (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:271:11)
relay_client.dart:271
I/flutter (25169): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (25169): │ 💡 Handling relay close, code: 4010, reason: Disconnecting for load balancing reasons

then when _client.connect method is executed this error appear immediately

I/flutter (25169): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (25169): │ #0   RelayClient._sendJsonRpcRequest (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:399:19)
relay_client.dart:399
I/flutter (25169): │ #1   RelayClient._onSubscribe (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:414:25)
relay_client.dart:414
I/flutter (25169): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (25169): │ StateError, reconnecting: Bad state: Cannot add event after closing
I/flutter (25169): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (25169): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (25169): │ #0   RelayClient._onSubscribe (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:421:19)
relay_client.dart:421
I/flutter (25169): │ #1   <asynchronous suspension>
I/flutter (25169): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (25169): │ ⚠️ RelayClient, onSubscribe error. Topic: e13e23197e59238bb4da2542e389fcbf141649921c3ab8a8b3c852c57a8d892d, Error: Bad state: Cannot add event after closing
I/flutter (25169): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Once Metamask/Trustwallet is launched this error appear and no connect pop up appear in Wallet

wc:6a684cad24ee6e93dfeab0b6add43521285fefd647e95577d204da5ba992f18c@2?relay-protocol=irn&symKey=95cfaf3386b45663a728bf07cb10507e830454c6ac38a92a97306fc979071d9d&methods=%5Bwc_sessionPropose%2Cwc_sessionRequest%5D%2C%5Bwc_authRequest%5D
I/flutter (25169): ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
I/flutter (25169): │ #0   RelayClient._sendJsonRpcRequest (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:399:19)
relay_client.dart:399
I/flutter (25169): │ #1   RelayClient.publish (package:walletconnect_flutter_v2/apis/core/relay_client/relay_client.dart:123:21)
relay_client.dart:123
I/flutter (25169): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
I/flutter (25169): │ StateError, reconnecting: Bad state: Cannot add event after closing
I/flutter (25169): └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

EDIT : to reproduce this you can try to connect and disconnect multiple times and restart your Dapp sometimes when you disconnect a wallet it will happen

I did more testing and I reproduce it after connecting and disconnecting wallet for 10 - 15 times, did hot restart sometimes and re debug app 2 - 3 times it's hard to reproduce but QA reported sometimes it happen on first run of app

I checked when it's happening _client.connect doesn't give response and we doesn't have URI or any error

AmjadKhan2k18 avatar Jul 28 '23 08:07 AmjadKhan2k18