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

Unauthorized pairing update request

Open matthewcarlreetz opened this issue 2 years ago • 15 comments

Describe the bug I receive the error {"context":"client"}{"context":"client/pairing"} Error: Unauthorized pairing update request when initializing the wallet connect client on React Native. This error shows 16-250 times when present.

SDK Version (if relevant)

  • Client: React Native
  • Version: "@walletconnect/client": "^2.0.0-beta.26"

To Reproduce Steps to reproduce the behavior: Initialize the client on React Native

        client = await WalletConnectClient.init({
          controller: true,
          projectId: Config.WALLET_CONNECT_PROJECT_ID,
          relayUrl: 'wss://relay.walletconnect.com',
          metadata: {
            name: 'Test',
            description: 'Test',
            url: Config.WALLET_CONNECT_METADATA_URL,
            icons: ['https://walletconnect.com/walletconnect-logo.png'],
          },
          storageOptions: {
            // eslint-disable-next-line @typescript-eslint/ban-ts-comment
            // @ts-ignore
            asyncStorage: AsyncStorage,
          },
        })

Expected behavior Initialize client without receiving errors

Screenshots

image000000

Smartphone (please complete the following information):

  • Device: Any Android or iPhone
  • OS: Any Android or iOS

Additional context It seems to work well outside of the error being present.

matthewcarlreetz avatar Apr 26 '22 18:04 matthewcarlreetz

@matthewcarlreetz Could you please tell me following

  1. React native version
  2. Did you enable hermes
  3. Run react-native info in your project and post output here

These would help with debugging 👌

xzilja avatar Apr 27 '22 08:04 xzilja

@matthewcarlreetz Could you please tell me following

  1. React native version
  2. Did you enable hermes
  3. Run react-native info in your project and post output here

These would help with debugging 👌

@IljaDaderko

  1. "react-native": "0.66.4"
  2. Hermes is enabled on Android
System:
    OS: macOS 12.3.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 14.16 GB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.8.0 - /opt/homebrew/bin/node
    Yarn: 1.22.18 - ~/Code/wallet-app/node_modules/.bin/yarn
    npm: 8.5.5 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 29.0.2, 30.0.2, 31.0.0
      System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs ARM 64 v8a, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play ARM 64 v8a, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-31 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8092744
    Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1 
    react-native: 0.66.4 => 0.66.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

matthewcarlreetz avatar Apr 27 '22 11:04 matthewcarlreetz

Any updates/thoughts on this?

matthewcarlreetz avatar May 02 '22 19:05 matthewcarlreetz

@matthewcarlreetz Next beta release is in the works, I can't give specific deadline at this moment, but it addresses pairing updates, so hopefully will resolve your issue. Meanwhile if you want to dig deeper, it looks like error is coming from onUpdate method located here https://github.com/WalletConnect/walletconnect-monorepo/blob/v2.0/packages/client/src/controllers/engine.ts#L588

It shouldn't be thrown by simply initialising the client, are you sure you are not calling any pairing/session update methods right after?

xzilja avatar May 02 '22 20:05 xzilja

@IljaDaderko I don't call pair until await WalletConnectClient.init has resolved. The error doesn't happen on the first app load, only on subsequent app loads. Every time I re-open the app the amount of errors grows.

matthewcarlreetz avatar May 04 '22 14:05 matthewcarlreetz

encountered the same problem in React Native

  1. "react-native": "0.68.0"
  2. Hermes is enabled on Android
react-native info
info Fetching system and libraries information...
System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 114.72 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.0/bin/yarn
    npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
    Watchman: 2022.03.14.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.1 - /usr/local/opt/openjdk/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.0 => 0.68.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
image

jasonzhouu avatar May 17 '22 06:05 jasonzhouu

@matthewcarlreetz @jasonzhouu we cut beta.50 canary release yesterday (jump from 26 to 50 is to signify api changes). We will be integrating it into our examples and documenting changes this week, once done, I'll ping you guys here to check if your issue still remains on this version. beta.50 changes up quiet a lot of things around pairing / update methods.

xzilja avatar May 17 '22 06:05 xzilja

We're getting the same for what it's worth; I tried out the beta 55 but things seem to be unstable right now.

LeeAlephium avatar Jun 13 '22 21:06 LeeAlephium

@LeeAlephium we recently released beta.102 (high jump in versioning is due to api changes) and package was renamed to sign-client, it is available here https://www.npmjs.com/package/@walletconnect/sign-client

You can find migration guide and some rough docs here https://gist.github.com/pedrouid/1a36c6a8776e49453838578ec84715e6 these will be moved to documentation site soon as well.

I believe @matthewcarlreetz was able to get past this issue on latest beta release?

xzilja avatar Jun 14 '22 06:06 xzilja

Excellent, I'll give it a try immediately and report back! And that document is a god-send, thank you.

LeeAlephium avatar Jun 14 '22 12:06 LeeAlephium

@IljaDaderko I'm getting "Missing or invalid connect requiredNamespaces" for some reason? I'm using the following:

    return wc.connect({
      requiredNamespaces: {
        alephium: {
          chains: [provider.permittedChain],
          methods: ['alph_getAccounts', 'alph_signContractCreationTx', 'alph_signScriptTx'],
        }
      }
    });

What exactly is invalid about it?

LeeAlephium avatar Jun 14 '22 13:06 LeeAlephium

@LeeAlephium You need to have events in there, even if you are not using any i.e. events: [] also format of provider.permittedChain plays a role, it should be namespace:chainID i.e. alephium:1 perhaps.

Better error messages are scoped for next beta 👍 so hopefully they will help with issues like this in the future.

xzilja avatar Jun 14 '22 13:06 xzilja

events:[] was all I needed, awesome 🙂 Yep, I'm aware of the chain format, but thank you for confirming!

LeeAlephium avatar Jun 14 '22 13:06 LeeAlephium

What is id on requests and responses? Should it be different each time?

LeeAlephium avatar Jun 14 '22 13:06 LeeAlephium

@LeeAlephium it's standard json rpc id you get with requests. When you respond you need to use id of reuqets you are replying to. Also for further discussion, could you please join our discord https://discord.com/invite/cB54BwPGru so we can keep this issue related to its topic. Feel free to ping me there @Aztec#0404

xzilja avatar Jun 14 '22 14:06 xzilja

@matthewcarlreetz is this still an issue?

finessevanes avatar Jan 18 '23 00:01 finessevanes