Git Product home page Git Product logo

Comments (7)

naeem-qv avatar naeem-qv commented on July 19, 2024

Seems like nodemailer is not working on edge functions like Cloudflare Workers, Vercel Edge Functions or Deno Deploy.

On Vercel I dont see a very detailed error:

TypeError: Class extends value #<Object> is not a constructor or null
    at (index.mjs:1:370367)
    at (__nitro:middleware.js:1:17)

Probably this is due to Node api being used like 'fs' that does not exist within edge worker functions.

As a workaround instead of nodemailer an external service like resend.com could be used: https://github.com/resend/resend-cloudflare-workers-example/blob/main/worker.js

Related: #1621 #1563

So we can't use nodemailer with nextjs?

from nodemailer.

MickL avatar MickL commented on July 19, 2024

Sure you can use it as long as you dont deploy on Edge Workers

from nodemailer.

andris9 avatar andris9 commented on July 19, 2024

Nodemailer does not work in any kind of Workers, only in "real" node.js.

from nodemailer.

MickL avatar MickL commented on July 19, 2024

This is exactly the point of this issue

from nodemailer.

andris9 avatar andris9 commented on July 19, 2024

The runtime for workers is not Node.js, it is more similar to a front-end runtime. That runtime lacks support for raw TCP and TLS APIs required by Nodemailer and as such Nodemailer will never work on it.

from nodemailer.

tcurdt avatar tcurdt commented on July 19, 2024

For example the Cloudflare runtime certainly has limitations.

What works is using the APIs (SES, SendGrid, Mailchannels) directly.
I also looked for some abstraction for these APIs. But nodemailer just ain't that.

from nodemailer.

sheecegardezi avatar sheecegardezi commented on July 19, 2024

The runtime for workers is not Node.js, it is more similar to a front-end runtime. That runtime lacks support for raw TCP and TLS APIs required by Nodemailer and as such Nodemailer will never work on it.

@andris9 net is supported now using the flag:

node_compat = true

in wrangler.toml

from nodemailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.