Uncaught (in promise) TypeError: Cannot read property 'generateKey' of undefined
See original GitHub issueHello,
I am new in this WalletConnect I am creating client sdk on browser side but getting some issue while performing createSession method. Can you please help me out with that.
Code of Walletconnect Initial Connection :
const walletConnector = new WalletConnect({
bridge: "https://bridge.walletconnect.org" // Required
});
/**
* Check if connection is already established
*/
if (!walletConnector.connected) {
// create new session
walletConnector.createSession().then(() => {
console.log("session");
const uri = walletConnector.uri;
console.log("uri" + uri);
console.log("wallet" + walletConnector.connected);
// display QR Code modal
WalletConnectQRCodeModal.open(uri, () => {
console.log("QR Code Modal closed");
});
});
// walletConnector.updateSession({chainId : 0,accounts :walletConnector.accounts});
// get uri for QR Code modal
}
/**
* Subscribe to connection events
*/
walletConnector.on("connect", (error, payload) => {
console.log("connect");
if (error) {
throw error;
}
// close QR Code Modal
WalletConnectQRCodeModal.close();
// // get provided accounts and chainId
// const { accounts, chainId } = payload.params[0];
});
walletConnector.on("session_update", (error, payload) => {
console.log("session_update");
if (error) {
throw error;
}
// get updated accounts and chainId
const { accounts, chainId } = payload.params[0];
});
walletConnector.on("disconnect", (error, payload) => {
console.log("disconnect");
if (error) {
throw error;
}
// delete walletConnector
});
Issue while running on browser :
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Cannot read property 'generateKey' of undefined · Issue #964 ...
Uncaught TypeError : Cannot read property 'generateKey' of undefined. It seems like it's coming from the webcrypto package.
Read more >Cannot read property 'importKey' of undefined, Web Crypto ...
I tried and got the solution. You can simply use the private key. Here it is: var sha256 = forge.md.sha256.create(); sha256.update(message, ...
Read more >SubtleCrypto.generateKey() - Web APIs | MDN
A Promise that fulfills with a CryptoKey (for symmetric algorithms) or a CryptoKeyPair (for public-key algorithms). Exceptions. The promise is ...
Read more >uncaught typeerror: cannot read properties of undefined (reading ...
Getting error Uncaught TypeError: Cannot read properties of undefined (reading 'generateKey') only when I run the flutter app over any server (apache2 in...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
As a JavaScript developer, I'm sure you've encountered the frustrating runtime TypeError Cannot read properties of undefined .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got a similar issue and found this by googling, so maybe this will help someone. In my case, the issue was that I was trying to access the page with Chrome on an insecure local network url (http://192.168.1.xxx), but Chrome doesn’t expose
window.crypto.subtle
in insecure contexts. Firefox seems to work, and I’d guess http://localhost… would also work.Thanks @astha-nimblechapps! 🙌 Someone else also reported this and I was about to publish
beta.5
so I will just take a quick look and include the fix