rainbowkit icon indicating copy to clipboard operation
rainbowkit copied to clipboard

[bug] `RainbowKitSiweNextAuthProvider` not working with NextAuth.js v5

Open edxeth opened this issue 1 year ago • 11 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

RainbowKit Version

1.3.2

wagmi Version

1.4.12

Current Behavior

I'm thrown a runtime error when I try to use RainbowKitSiweNextAuthProvider with NextAuth.js v5:

image

The issue has appeared upon migration to v5. (it worked on v4) Unwrapping RainbowKitProvider from RainbowKitSiweNextAuthProvider resolves the issue even though I'm not able to leverage Sign-in with Ethereum (siwe) then.

@components/RainbowKit.tsx:

image

@/app/layout.tsx:

image

My dependencies:

  • @rainbow-me/rainbowkit: 1.3.2
  • @rainbow-me/rainbowkit-siwe-next-auth: 0.3.4
  • next-auth: 5.0.0-beta.4
  • siwe: 2.1.4
  • viem: 1.21.3
  • wagmi: 1.4.12

Expected Behavior

No response

Steps To Reproduce

No response

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

No response

Anything else?

No response

edxeth avatar Jan 03 '24 20:01 edxeth

I think it is not compatible with next-auth v5 yet https://github.com/rainbow-me/rainbowkit/releases/tag/%40rainbow-me%2Frainbowkit-siwe-next-auth%400.3.3

c0rdeiro avatar Jan 04 '24 18:01 c0rdeiro

@edxeth Currently the peer version is not supported and you should receive a package manager warning. Feel free to ping here when next-auth v5 is out of beta, and we can work on adding support!

DanielSinclair avatar Jan 04 '24 20:01 DanielSinclair

@c0rdeiro I see, thanks for the reference!

@DanielSinclair I will, looking forward to that :)

PS: out of curiosity, wagmi v2 and viem v2 were released so when can we expect RainbowKit to support the new version?

edxeth avatar Jan 04 '24 22:01 edxeth

@edxeth The wagmi v2 and viem v2 support will be released very soon, but we do have a beta version that you can try out. Feel free to look at the migration guide here: https://beta.rainbowkit.com/guides/rainbowkit-wagmi-v2

Let me know if you find any issues 👍

magiziz avatar Jan 24 '24 22:01 magiziz

@KosmosKey with that will the rainbowkit-siwe-next-auth dependency be upgraded to [email protected] ?

KeeganEad avatar Feb 10 '24 14:02 KeeganEad

@KosmosKey with that will the rainbowkit-siwe-next-auth dependency be upgraded to [email protected] ?

Yes that's correct. RainbowKit will be upgraded to 2.x. Just make sure to update @rainbow-me/rainbowkit-siwe-next-auth to the latest version 0.4.x once it's out.

magiziz avatar Feb 10 '24 16:02 magiziz

@edxeth Are you still facing this issue ? If yes do you have a small code example i can look at ?

magiziz avatar Feb 14 '24 19:02 magiziz

@KosmosKey is Rainbowkit v2 now supporting Next-Auth v5 (still in beta)?

edxeth avatar Feb 14 '24 23:02 edxeth

@KosmosKey is Rainbowkit v2 now supporting Next-Auth v5 (still in beta)?

We don't support beta yet. Are you able to use the latest non beta version for now and when the v5 launches we'll make sure to update it with RainbowKit.

magiziz avatar Feb 15 '24 14:02 magiziz

Auth.js seems to be approaching a production release of v5 soon, so we will begin working on this. We are also evaluating other improvements to the Authentication/SIWE flow. Do you use SIWE alongside other auth methods in your next-auth configuration, or would you prefer if most of the boilerplate implementation is handled within RainbowKit's adapter package? I think we have the opportunity to make this much simpler for devs! Feedback or ideas are appreciated.

DanielSinclair avatar May 23 '24 07:05 DanielSinclair

@DanielSinclair Although next auth does require a significant amount of boilerplate I think the priority should move away from siwe lib since it requires ethers still I see you're working here #1997 on moving to the new viem siwe which already makes me very happy. Keep up the great work

c0rdeiro avatar May 23 '24 15:05 c0rdeiro