walletconnect-monorepo
walletconnect-monorepo copied to clipboard
Cannot find module 'better-sqlite3'
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
Can you please provide repro steps?
- Start Next Js project
- Install Walletconnect
- Init Walletconnect
@alejomendoza could you try with latest rc.2
. Also, better-sqlite3
will only get used on server side (nodejs), so you should
- Install this dependency as per nodejs guide https://docs.walletconnect.com/2.0/javascript/guides/nodejs
- 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
I can confirm that the approach of installing better-sqlite3
with
npm install --save @walletconnect/sign-client@rc better-sqlite3
solves the issue.
Closing since this dependency is no longer used.