rainbowkit icon indicating copy to clipboard operation
rainbowkit copied to clipboard

[bug] Error preparing message, please retry!

Open nickolastazes opened this issue 3 years ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

RainbowKit Version

0.8.1

wagmi Version

0.10.10

Current Behavior

Hey, I just installed Rainbowkit and tried to make the authentication process work. But, unfortunately, I can't sign in with Ethereum because I get the error "Error preparing message, please retry!".

Here is a screenshot

Screenshot 2023-01-17 at 11 18 46 PM

Expected Behavior

To generate the message successfully.

Steps To Reproduce

No response

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

No response

Anything else?

It's probably my fault since I am a noob, but I would highly appreciate some help. ✌️

nickolastazes avatar Jan 17 '23 21:01 nickolastazes

Hey @nickolastazes. I think your issue is that you're missing the NEXTAUTH_SECRET env variable. Create a new .env.local with a generated secret and check back here if the problem persists.

Reference the example here: https://github.com/rainbow-me/rainbowkit/blob/01f61336fcc252ef4475987b1b65d5dabee690c8/examples/with-next-siwe-next-auth/.env.local.example#L1

DanielSinclair avatar Jan 18 '23 02:01 DanielSinclair

Gm @DanielSinclair, the problem is already fixed. Thank you for your time and help!

nickolastazes avatar Jan 18 '23 02:01 nickolastazes

@nickolastazes how did you solve it?

mikelord007 avatar Apr 24 '23 14:04 mikelord007

i am getting the same error and i tried the solution suggested by @DanielSinclair but it did not worked for me, how did you fix it @nickolastazes

shishirtiwari23 avatar May 11 '23 13:05 shishirtiwari23

Never mind, i fixed it myself, the problem wasn't in my app.js/ts but it was in api/auth/[...nextauth], and in the env, what happened in my case was i thought i only needed to setup app.js/ts not the other file inside api folder along with the env correctly setup them by following the example provided by team rainbow solved the problem

Example App

shishirtiwari23 avatar May 11 '23 14:05 shishirtiwari23

Exactly @shishirtiwari23, the issue is the nextauth file. However, the provided file in the example didn't work for me, so I had to tweak it myself.

nickolastazes avatar May 11 '23 17:05 nickolastazes

@nickolastazes Can you share your implementation please?

VampishWolf avatar May 15 '23 11:05 VampishWolf

@nickolastazes same here, can you share your tweaks?

mhpaler avatar Jun 14 '23 23:06 mhpaler

@VampishWolf @mpaler if you web3 wallet based auth, i would highly recommend using thirdweb's wallet service which does the same perhaps opensea's, because there are major bugs in rainbow kit's version, and those bugs are so critical that a user might be able access something that he shouldn't, like when we switch wallet rainbow kit does not automatically detects that there is a wallet change instead you would have to write that mechanism yourself

shishirtiwari23 avatar Jun 15 '23 00:06 shishirtiwari23

@shishirtiwari23

  • RainbowKit's Auth API is built on top of the siwe library with the help of Spruce. It's safe and secure, and simply relies on a wallet signing a message for the dApp. We'd have bigger problems in this industry if there was a vulnerability in wallet signatures 😅
  • What do you mean by "switch wallet"? Can look into improving the API if we're missing anything

DanielSinclair avatar Jun 15 '23 01:06 DanielSinclair