walletconnect-monorepo: Cannot read properties of undefined (reading 'importKey')

I am running latest version of nextjs, @walletconnect/client and @walletconnect/qrcode-modal

When the button is pressed the modal shows but an error in developers tools shows

“Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘importKey’)”

It works on development build but now production

const connector = new WalletConnect({
  // Required
  bridge: 'https://bridge.walletconnect.org',
  qrcodeModal: QRCodeModal,
  // Required
  clientMeta: {
    description: 'My website description ',
    url: 'https://mywebsite.url',
    icons: ['../assets/svg/icon.svg'],
    name: 'My website name',
  },
});

const connect = () => {
  // Check if connection is already established
  if (!connector.connected) {
    // create new session
    connector.createSession();
  } else {
    connector.sess;
  }
};

// This is used to start login process with WalletConnect
<button onClick={connect}></button

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22

Most upvoted comments

And you closed this???

  1. If your code throws a “cannot read property of undefined” error from deep down in your functions, it’s your bug. You must check that something is not undefined before reading properties from it
  2. If the issue is that the website is being served over http and it is required that it is served over https, then check for that and throw an error that says so, possibly at a much earlier stage.

You most likely are not using SSL on your domain. This error appears if you open your website via http vs https.

You most likely are not using SSL on your domain. This error appears if you open your website via http vs https.

My Website uses HTTPS still, I am getting this error.

I’m facing the same error on mobile phones while invoking and eth_sign json rpc request to metamask app installed on mobile. Desktop with metamask browser extension works perfectly.

Same problem here.

It’s practically impossible to test a dApp without building it and serving through a trusted domain.

i also got same error in mobile phones, at laptop/desktop its working fine. Error is: cannot read properties of undefined ( reading importKey` )

me too

nextjs13