-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[auth][error] MissingAdapter: Email login requires an adapter (firebase adapter and Resend) #10632
Comments
Hi Mabiri, I am not a maintainer but saw your issue here and want to give a heads up that
if you can try with firebase-admin 11 that might be a path forward. I am trying to raise a PR for updating to firebase-admin 12 at the moment so maybe firebase-admin 12 can work in near future. Also if you can share any more errors you are getting, does checking types maybe |
hello NickFoden , thanks for your respond , i try firebase-admin version 11.4.1 , but having the same issues .. |
Thanks for pointing this out, it looks liek this is a bug in the assertion process (checking to make sure yuo've added a database adapter) when using an email adapter and also doing the edge-runtime split config. Basically, it's checking in the edge runtime (where you don't have the adapter in the auth.js config), to ensure that the provider (resend) can operate correctly. But actually, we're not sending any emails in the middleware (edge runtime) anyway, so we can delay that checking to only happen in places where we would actually be sending an email (like in the normal serverles functions / backend / API route). I'll try to find some time and see where we can make this change. If anyone wants to take a stab that'd be great too :) EDIT: Notes for later:
|
For now, since the Email provider actually isn't doing any work in the middleware / edge runtimes where its throwing this error, you can move your Email provider to the config where you have your adapter as well, so they both don't get included in the middleware / edge runtime enviornments. That should avoid this error and still have your Resend / whatever Email provider be able to send emails and use up verificationTokens upon signin 👍 |
thanks you @ndom91 for your respond , i try mooving the Email provider the config where i have my adapter , but still i am having the same errors... |
I'm having exactly the same issue :-) Curious about a fix! |
I tried using a fake adapter in de middleware part. It won't show errors now, but resend does not work either... The import NextAuth from "next-auth";
import { Adapter, VerificationToken } from "next-auth/adapters";
import { authConfig } from "./auth.config";
const fakeEmailAdapter: Adapter = {
createVerificationToken: (verificationToken: VerificationToken) => undefined,
useVerificationToken: (params: { identifier: string; token: string }) => null,
getUserByEmail: (email: string) => null,
};
export default NextAuth({ ...authConfig, adapter: fakeEmailAdapter }).auth; |
did you find a solution ? |
Hi good morning, anyone have any updates here ? Thank you 🙇 😊 |
Maybe rephrase as
|
I'm experiencing the same issue with MongoDB, Prisma, and SendGrid. I also opened a discussion (#10942), but it looks like we're experiencing the same issue. |
thank you , i will take it in mind , next time , 👌 |
This is a good idea! I don't want to do anything in my middleware because I use while having this in
the app works between subsequent refreshes, and I'm getting no errors in the console, but once I log in and I have a session in cookies, I'm getting the following error: Do you have any suggestions on how to fix this if i don't want to do anything in my middleware? Any help is appreciated! 🙏 |
Hi @akoskm I think you want to initialize the prisma client differently because of hot reloading etc. Check prisma + next.js examples for the recommended approach I use this / forget where I picked it up from, but similarly I use this below for next.js projects (and I also do not use the app router, am waiting for more stable/mature release that is less verbose and also when "we" have React 19 etc)
|
Thanks @NickFoden! I know where you got that from 😃 I asked the AI on the Prisma site what's the best way to expose the Prisma client object, and it replied with a similar code:
I tried the code you suggested as well - which does almost the same thing - but I'm getting the same error. |
hey @ndom91 I'd love to give this a shot and create PR that fixes the issue based on your first comment. However, after reading this, I'm curious if you're aware that the workaround that was suggested doesn't make the issue go away. Considering that, do you think simply moving the check is sufficient? I can give it a shot after work and see if it fixes the issue and if the login/session still works. |
@akoskm Yeah, go for it! I think it shuold be sufficient, but haven't had time to dig in much further myself. We'd appreciate if you or anyone else could spend some time digging into this a bit more 🙏 . It might be as simple as just moving that assertion to a bit later in the process. |
Also regarding the prisma errors, it seems like Prisma is still tryign to be executed on the edge runtime somewhere. What version of prisma are you using? As of
|
Adapter type
@auth/firebase-adapter
Environment
Reproduction URL
https://github.com/tidianeb5/missing-adapter-issues-firebase-adapter-and-resend
Describe the issue
Issue Description
I'm encountering an error when trying to use email login with the next-auth package:
Configuration
I'm using the following configuration:
5.0.0-beta.15
According to the documentation, if you have an adapter that is not compatible with the Edge runtime, you need to separate the configuration into two files.
auth.config.ts
:auth.ts
(API Route):[...nextauth].ts
(API Route):middleware.ts
:Expected Behavior
I expect the email login functionality to work correctly without any errors.
Please let me know if you need any additional information or if I should provide more details about my setup or the steps I've taken to reproduce this issue.
How to reproduce
Just clone the project , and add envs :
AUTH_SECRET,SERVICE_ACCOUNT_PRIVATE_KEY,SERVICE_ACCOUNT_CLIENT_EMAIL,NEXT_PUBLIC_FIREBASE_PROJECT_ID ...
Expected behavior
Not showing the error .
The text was updated successfully, but these errors were encountered: