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

cleanBeforeInit function throws uncaught error preventing WalletConnect QR code from being displayed #410

Open
nop33 opened this issue Aug 22, 2024 · 7 comments
Assignees

Comments

@nop33
Copy link
Member

nop33 commented Aug 22, 2024

This happens on the Ayin website which (as I was informed today) uses our SDK version 0.45.0.

Here's a video walkthrough of the error:

Kapture.2024-08-22.at.15.38.18.mp4

To reproduce you can delete the indexed DB:

image

@polarker
Copy link
Member

Nice. @Lbqds Please help us investigate

@Lbqds
Copy link
Member

Lbqds commented Aug 23, 2024

The root cause of this issue is in this function: https://github.com/jakearchibald/idb-keyval/blob/6695b178d3e1a6a6252d6d72bf8b1830253aadc1/src/index.ts#L12

In normal cases, when the database does not exist, const request = indexedDB.open(dbName) is called to create the database, where dbName is WALLET_CONNECT_V2_INDEXED_DB. Then the keyvaluestorage object store is created in the onupgradeneeded callback.

The issue with the ayin app is that after calling indexedDB.open('WALLET_CONNECT_V2_INDEXED_DB'), the onupgradeneeded callback is not triggered, meaning the keyvaluestorage object store is not created, leading to the error: One of the specified object stores was not found.

I’m not sure why this happens, I did the following tests:

  • alephium-dex + sdk v1.5.1
  • bridge-ui + sdk v1.5.1
  • alephium-dex + sdk v0.45.0 (which is the version ayin app is using)

None of the above tests has this issue, after deleting database WALLET_CONNECT_V2_INDEXED_DB, clicking the connect button or refreshing the page correctly creates the database and the keyvaluestorage object store.

And this issue doesn’t seem to be related to cleanBeforeInit, because walletconnect also needs to create the keyvaluestorage within SignClient.init. I’m not sure if there’s a simple way to fix this issue in sdk. Perhaps we could ask ayin to upgrade to the latest sdk version and see if this issue still exists. WDYT?

@Lbqds
Copy link
Member

Lbqds commented Aug 23, 2024

By the way, since migrate is called without await, we can't directly catch this exception within the sdk.

@polarker
Copy link
Member

It makes sense to upgrade to the latest SDK version. At least for wallet connect provider

@nop33
Copy link
Member Author

nop33 commented Aug 23, 2024

Yes, I've already told them since yesterday to first update to latest SDK to see if the problem gets resolved.

@nop33
Copy link
Member Author

nop33 commented Aug 28, 2024

The Ayin team has shared a testing link where they updated to the latest SDK (v1.5.2) and the same issue is observed.

@nop33
Copy link
Member Author

nop33 commented Aug 28, 2024

I discovered that when clearing all cache data solves the problem for Ayin. Yet, this is not necessary for all other dApps.

Kapture.2024-08-28.at.10.28.35.mp4

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

3 participants