Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'importKey') #689

Closed
GnussonNet opened this issue Jan 9, 2022 · 22 comments
Closed

Cannot read properties of undefined (reading 'importKey') #689

GnussonNet opened this issue Jan 9, 2022 · 22 comments

Comments

@GnussonNet
Copy link

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
@pasevin
Copy link

pasevin commented Jan 10, 2022

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

@php4fan
Copy link

php4fan commented Jun 23, 2022

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.

@rahujoshi
Copy link

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.

@ZeeshanAhmadKhalil
Copy link

For me its giving this error on https and on http its not giving this error but i am unable to connect my wallet :/

@aakash4dev
Copy link

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

@364734461
Copy link

me too

nextjs13

@Nightvision53
Copy link

I am getting this error on my mobile on NextJS 12 while on the dev server (HTTP).

@FatNerdPeng
Copy link

I encountered this problem on the development server. My situation is that my host is running normally and can generate QR code, but when other computers in the LAN access my project, the QR code can pop up, but the console will have this error.

@juniarto-samsudin
Copy link

Same problem here:
Unhandled Runtime Error
TypeError: Cannot read properties of undefined (reading 'importKey')

Only when serving on localhost [127.0.0.1] works...

@OctoD
Copy link

OctoD commented Mar 23, 2023

Same problem here.

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

@rozztopher
Copy link

This needs further looking into.

It happens on mobile devices regardless if we're using https or not.

@php4fan
Copy link

php4fan commented May 17, 2023

This hasn't been reopened yet? Unbelievable.

@Satwik-4
Copy link

I encountered this problem on the development server. My situation is that my host is running normally and can generate QR code, but when other computers in the LAN access my project, the QR code can pop up, but the console will have this error.

@FatNerdPeng Were you able to solve this error? I'm also experiencing exactly the same thing

@Willzxxz
Copy link

please reopen obviously a lot of people are having this issue, including myself

@0xtchandragupta
Copy link

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.

@FatNerdPeng
Copy link

I encountered this problem on the development server. My situation is that my host is running normally and can generate QR code, but when other computers in the LAN access my project, the QR code can pop up, but the console will have this error.

@FatNerdPeng Were you able to solve this error? I'm also experiencing exactly the same thing

Unfortunately, I haven't solved this problem yet.

@ghost
Copy link

ghost commented Jul 13, 2023

Same error here please re-open

@amitdubey6261
Copy link

facing same problem reopen it...

@KelvinSan
Copy link

Same error

@eliudsaj
Copy link

eliudsaj commented Feb 3, 2024

same error here

@amitdubey6261
Copy link

For me this problem is resolved by using the Https server, when. I was calling the backend via HTTP(unsecured), it's not allowed to make secure calls from unsecured http frontend, make sure you deploy your server, functionality on https

@KelvinSan
Copy link

How can you use this from localhost?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests