web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

WalletConnectV2 TypeError: Og2.default.init is not a function #840

Open ersanyakit opened this issue 2 years ago • 4 comments

Im using VITEJS + React TS

Seeing an error when trying to use wallet connect in our dapp when deployed on IPFS. activate.ts:57 TypeError: Og2.default.init is not a function at hr2.createClient (index.cjs.js:27:29719) at hr2.initialize (index.cjs.js:27:29572) at hr2.init (index.cjs.js:27:26718) at I2.initialize (index.cjs.js:1:6874) at I2.init (index.cjs.js:1:2663) at WalletConnectV2.<anonymous> (index.js:87:79) at Generator.next (<anonymous>) at fulfilled (tslib.js:112:62)

Ekran Resmi 2023-07-21 17 13 36

Test URL : https://imon.ai

ersanyakit avatar Jul 21 '23 14:07 ersanyakit

Im using VITEJS + React TS

Seeing an error when trying to use wallet connect in our dapp when deployed on IPFS. activate.ts:57 TypeError: Og2.default.init is not a function at hr2.createClient (index.cjs.js:27:29719) at hr2.initialize (index.cjs.js:27:29572) at hr2.init (index.cjs.js:27:26718) at I2.initialize (index.cjs.js:1:6874) at I2.init (index.cjs.js:1:2663) at WalletConnectV2.<anonymous> (index.js:87:79) at Generator.next (<anonymous>) at fulfilled (tslib.js:112:62)

Ekran Resmi 2023-07-21 17 13 36 Test URL : https://imon.ai

Have you managed to resolve this issue?

Nookee411 avatar Jul 28 '23 13:07 Nookee411

yes, its fixed. just update your vite.config.ts

Ekran Resmi 2023-07-29 08 59 14

alias: { '@walletconnect/ethereum-provider': '../../../@walletconnect/ethereum-provider/dist/index.es.js', '@walletconnect/utils': '../../../@walletconnect/utils/dist/index.umd.js', '@': path.resolve(__dirname, './src'), }

ersanyakit avatar Jul 29 '23 06:07 ersanyakit

I think this issue is related to #840 and a potential fix in web3-react without updating packaging is here: https://github.com/Uniswap/web3-react/issues/840#issuecomment-1613619864

chris13524 avatar Jul 30 '23 12:07 chris13524

@ersanyakit thank you for the workaround, it worked for me. bumping this issue

christiecc8 avatar Oct 13 '23 17:10 christiecc8