NextJS Deployed to Workers with SendEmail binding, Types issue.
Hey,
Quiet newbie around workers, I tried to create NextJS project (via OpenNext) and deploy it to Workers, achieved that, next was to bind a D1 Database, this one almost went smoothly, right now I am trying to bind SendEmail, but there is this issue I could not overcome.
First things were that Module
cloudflare:email was non existent, so with help of AI - managed to extend webpack configuration to declare external cloudflare:email module, and provide a mock to that.
Now issue is with workload, after successfully deploying to Workers, and trying to execute the code responsible for SendEmail, there is an error occurring, as below.
, does anyone know how to resolve this?
I assume this might be an issue with cloudflare-env.d.ts types that are different than the ones that SendEmail is expecting, right?
Kind regards,
T1 Reply
Hey, to anyone who would struggle same, I just created 2nd worker, created service binding, and remotely called 2nd worker to do the mailing for me.
NextJS App Router, example code snippet
2nd worker snippet