walletconnect-monorepo: Error: Missing or invalid topic field
We are seeing a lot of errors coming from the wallet connect socket transport all the below: Error: Missing or invalid topic field
Logs:
message: "Uncaught (in promise): Error: Missing or invalid topic field↵Error: Missing or invalid topic field↵ at SocketTransport.send (https://localhost:4251/default~modules-approval-approval-module~modules-change-password-change-password-module~modules-chan~60cd62e9.js:1560:19)↵ at WalletConnect.<anonymous> (https://localhost:4251/default~modules-approval-approval-module~modules-change-password-change-password-module~modules-chan~60cd62e9.js:698:29)↵ at Generator.next (<anonymous>)↵ at fulfilled (https://localhost:4251/vendor.js:212225:58)↵ at ZoneDelegate.invoke (https://localhost:4251/polyfills.js:440:30)↵ at Object.onInvoke (https://localhost:4251/vendor.js:56946:33)↵ at ZoneDelegate.invoke (https://localhost:4251/polyfills.js:439:36)↵ at Zone.run (https://localhost:4251/polyfills.js:197:47)↵ at https://localhost:4251/polyfills.js:938:38↵ at ZoneDelegate.invokeTask (https://localhost:4251/polyfills.js:475:35)"
stackTrace: "send (webpack:///node_modules/@walletconnect/socket-transport/dist/cjs/index.js:57:)↵tslib_1.__awaiter (webpack:///node_modules/@walletconnect/core/dist/cjs/index.js:577:)↵fulfilled (webpack:///node_modules/tslib/tslib.es6.js:70:41)↵invoke (webpack:///node_modules/zone.js/dist/zone.js:396:)↵onInvoke (webpack:///node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js:27815:)↵invoke (webpack:///node_modules/zone.js/dist/zone.js:395:)↵run (webpack:///node_modules/zone.js/dist/zone.js:153:)↵zone.scheduleMicroTask (webpack:///node_modules/zone.js/dist/zone.js:894:)↵invokeTask (webpack:///node_modules/zone.js/dist/zone.js:431:)↵scheduleResolveOrReject (webpack:///node_modules/zone.js/dist/zone.js:836:)↵function (webpack:///node_modules/zone.js/dist/zone.js:750:)↵rejected (webpack:///node_modules/tslib/tslib.es6.js:71:87)↵invoke (webpack:///node_modules/zone.js/dist/zone.js:396:)↵onInvoke (webpack:///node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js:27815:)↵invoke (webpack:///node_modules/zone.js/dist/zone.js:395:)↵run (webpack:///node_modules/zone.js/dist/zone.js:153:)↵zone.scheduleMicroTask (webpack:///node_modules/zone.js/dist/zone.js:894:)↵invokeTask (webpack:///node_modules/zone.js/dist/zone.js:431:)↵onInvokeTask (webpack:///node_modules/@angular/core/__ivy_ngcc__/fesm5/core.js:27803:)"
Our setup looks fine so not sure why it keeps erroring. It actually keeps working and does not break but would rather not have that error emitting in the console.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 22
- Comments: 36 (4 by maintainers)
Commits related to this issue
- Fix WalletConnect not working after disconnection (see https://github.com/WalletConnect/walletconnect-monorepo/issues/315) — committed to LedgerHQ/ledger-live by lambertkevin 2 years ago
- Fix WalletConnect not working after disconnection (see https://github.com/WalletConnect/walletconnect-monorepo/issues/315) — committed to LedgerHQ/ledger-live by lambertkevin 2 years ago
- LIVE-2632 - Bugfix: WalletConnect error on disconnect (#326) * Fix react error for WC modal link not init as str * Fix WalletConnect not working after disconnection (see https://github.com/WalletC... — committed to LedgerHQ/ledger-live by lambertkevin 2 years ago
I’m getting the same error probably for the exact reason pedrouid indicated: I’m calling disconnect before sending anything. The reason I’m doing so it because I want to discard the old (cached) connection and scan a new QR code.
Maybe there is a more elegant way ensure that “startSession” actually starts a brand new connection and does not just reuse an old cashed connection?
PS: here is the workaround for my use case. If you want to make sure that walletconnect starts in a clean state, just delete its local storage before initializing it: window.localStorage.removeItem(‘walletconnect’);
This issue was opened almost 2 years ago. C’mon dev team
same, I am still getting this issue
Same problem here when connecting to metamask via walletconnect on mobile
I encountered this issue, and was able to get past it. It seems like this happens when the params are not available. I checked my code, and there were some bugs which were not setting the required params correctly. Once I ensured everything was correct in code, this error was gone.
Facing this error when trying to
approveSession. This is happening 1/5 times on an average.@luziusmeisser 's
window.localStorage.removeItem('walletconnect');solution works except I sometimes get 2 QR codes whenprovider.enable()is triggered afterwindow.localStorage.removeItem('walletconnect');. Anybody knows the solution to this ?.Same problem 😕 But my app work anyway