walletconnect-monorepo icon indicating copy to clipboard operation
walletconnect-monorepo copied to clipboard

Cannot find module 'better-sqlite3'

Open alejomendoza opened this issue 2 years ago • 3 comments

Describe the bug Next js app breaks when installing wallet connect client "@walletconnect/sign-client": "^2.0.0-rc.0"

Error: Cannot find module 'better-sqlite3'
Require stack:
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/keyvaluestorage/dist/cjs/node-js/index.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/keyvaluestorage/dist/cjs/index.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/core/dist/cjs/core.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/core/dist/cjs/index.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/sign-client/dist/cjs/client.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/@walletconnect/sign-client/dist/cjs/index.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/apps/next/.next/server/pages/sign-in.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/server/require.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/server/load-components.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/build/utils.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/build/output/store.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/build/output/index.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/cli/next-dev.js
- /Users/alejomendoza/Sites/skyhitz/skyhitz-expo-next/node_modules/next/dist/bin/next

alejomendoza avatar Jul 21 '22 16:07 alejomendoza

Can you please provide repro steps?

arein avatar Jul 22 '22 13:07 arein

  1. Start Next Js project
  2. Install Walletconnect
  3. Init Walletconnect

alejomendoza avatar Jul 25 '22 13:07 alejomendoza

@alejomendoza could you try with latest rc.2. Also, better-sqlite3 will only get used on server side (nodejs), so you should

  1. Install this dependency as per nodejs guide https://docs.walletconnect.com/2.0/javascript/guides/nodejs
  2. Only use sign sdk client side i.e within useEffect. Our wallet example actually uses this exact approach with nextjs https://github.com/WalletConnect/web-examples/tree/main/wallets/react-wallet-v2

xzilja avatar Aug 16 '22 15:08 xzilja

I can confirm that the approach of installing better-sqlite3 with

npm install --save @walletconnect/sign-client@rc better-sqlite3

solves the issue.

raiseerco avatar Oct 02 '22 17:10 raiseerco

Closing since this dependency is no longer used.

bkrem avatar Nov 25 '22 14:11 bkrem