Skip to content
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

nodemailer provider can't be used as middleware #10919

Closed
arslan2012 opened this issue May 15, 2024 · 2 comments
Closed

nodemailer provider can't be used as middleware #10919

arslan2012 opened this issue May 15, 2024 · 2 comments
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@arslan2012
Copy link

Provider type

Email

Environment

System:
    OS: Linux 6.6 Manjaro Linux
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Memory: 23.45 GB / 31.27 GB
    Container: Yes
    Shell: 5.2.26 - /bin/bash
  Binaries:
    Node: 21.6.2 - /usr/bin/node
    pnpm: 8.15.2 - /usr/bin/pnpm
  npmPackages:
    @auth/unstorage-adapter: ^2.0.0 => 2.1.0 
    next: latest => 14.2.3 
    next-auth: beta => 5.0.0-beta.18 
    react: ^18.2.0 => 18.3.1 

Reproduction URL

https://github.com/arslan2012/nodemailer-test

Describe the issue

As soon as you add Nodemailer the auth.ts, middleware stops working, throwing below error

⨯ Error: The edge runtime does not support Node.js 'stream' module.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime

or maybe this error

 ⨯ node_modules/.pnpm/nodemailer@6.9.13/node_modules/nodemailer/lib/base64/index.js (56:0) @ <unknown>
 ⨯ Class extends value undefined is not a constructor or null
null

disabling middleware or downgrading to next-auth 4 both fixes this issue.
So this bug is next-auth 5 only.

How to reproduce

add Nodemailer provider to the auth.ts and enable middleware

Expected behavior

everything should work fine.

@arslan2012 arslan2012 added bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels May 15, 2024
@arslan2012 arslan2012 changed the title nodemailer provider can be used as middleware nodemailer provider can't be used as middleware May 15, 2024
@balazsorban44
Copy link
Member

Please see the docs: https://authjs.dev/guides/edge-compatibility

@arslan2012
Copy link
Author

But the error is occurring on my local machine, maybe I'm on the edge, my computer definitely isn't.
per my Environment section, I'm using Node 21 on a Linux machine.
@balazsorban44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

2 participants