family / connectkit

Connecting a wallet, made simple.
https://docs.family.co/connectkit
BSD 2-Clause "Simplified" License
854 stars 184 forks source link

[BUG] Siwe with Next JS throws error on pressing sign button #395

Open Suhel-Kap opened 4 months ago

Suhel-Kap commented 4 months ago

Describe the bug

As soon as I press the sign button on the modal, i get the error saying

Error: Objects are not valid as a React child (found: Error: Failed to fetch SIWE session). If you meant to render a collection of children, use an array instead.
    at mapIntoArray (react.development.js:1967:13)
    at mapChildren (react.development.js:1996:3)
    at Object.toArray (react.development.js:2048:10)
    at flattenChildren (index.es.js:356:71)
    at Button (index.es.js:4742:11)
    at renderWithHooks (react-dom.development.js:11121:18)
    at updateFunctionComponent (react-dom.development.js:16290:20)
    at beginWork$1 (react-dom.development.js:18472:16)
    at beginWork (react-dom.development.js:26927:14)
    at performUnitOfWork (react-dom.development.js:25748:12)
    at workLoopSync (react-dom.development.js:25464:5)
    at renderRootSync (react-dom.development.js:25419:7)
    at recoverFromConcurrentError (react-dom.development.js:24597:20)
    at performSyncWorkOnRoot (react-dom.development.js:24899:20)
    at flushSyncWorkAcrossRoots_impl (react-dom.development.js:7758:13)
    at flushSyncWorkOnAllRoots (react-dom.development.js:7718:3)
    at processRootScheduleInMicrotask (react-dom.development.js:7863:3)
    at eval (react-dom.development.js:8034:7) 

To reproduce

Clone the repo https://github.com/Suhel-Kap/token-swaps/tree/connect-kit-siwe and switch to the connect-kit-siwe branch and run yarn and yarn dev.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment details

    "@tanstack/react-query": "^5.40.1",
    "class-variance-authority": "^0.7.0",
    "client-only": "^0.0.1",
    "connectkit": "^1.8.0",
    "connectkit-next-siwe": "^0.3.0",
    "next": "14.2.3",
    "react": "^18",
    "react-dom": "^18",
    "viem": ">=2.13.3",
    "wagmi": "^2.9.10"
Suhel-Kap commented 4 months ago

Another error which is thrown at times is

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

Call Stack
eval
node_modules/connectkit/build/index.es.js (9414:1)
petermazzocco commented 2 months ago

Anyone find a solution for this? @Suhel-Kap

Suhel-Kap commented 2 months ago

Switching to rainbow kit worked for me 🤓☝🏻

petermazzocco commented 2 months ago

Hoping they get this resolved but it looks like I might have to switch to rainbowkit as well

sowedoO commented 1 month ago

facing the same issue, any fix out yet?

petermazzocco commented 1 month ago

facing the same issue, any fix out yet?

Ended up switching to RainbowKit