giuseppelt / EmailFlare

Send emails from your domain through Cloudflare for free. Self host on your account.
https://emailflare.breakp.dev
MIT License
295 stars 24 forks source link

Uncaught Error: No such module "node:async_hooks". imported from "worker.js" #5

Closed louis-eyond closed 1 year ago

louis-eyond commented 1 year ago

Following the Tutorial at step Manual deploy 2 (https://www.breakp.dev/blog/email-flare-send-from-worker-for-free/#:~:text=worker.js.-,Drag%20and%20drop,-it%20on%20the), I get Uncaught Error: No such module "node:async_hooks". imported from "worker.js" in the Workers code editor.

I did try the Auto deploy option first, but was getting a 400 error, so thought I would go manual and see what was going on.

I found some references to adding the nodejs_compat compatibility flag, but it seems you would have to do that in the wrangler.toml (https://developers.cloudflare.com/workers/runtime-apis/nodejs/#enable-nodejs-with-workers), which would change the steps in your Tutorial.

Before I went too far down the rabbit hole, I thought I would checkin and see if this is something that is already solved.

Thanks

giuseppelt commented 1 year ago

Hi, 400 error means wrong data input. Another user was putting the wrong worker name. You should put only the name of the worker, not the entire address. For him, this fixed the issue. If there's something else, could you mind posting a screen, like he did in #2

About manual deploy there's a issue with the nodejs_flag, as the cloudflare dashboard doesn't provide a way to activate it. I'm checking for a command that does that form the terminal. I will update the instructions.

Anyway, please, try again the auto deploy and let me know if it worked for you.

louis-eyond commented 1 year ago

You got it exactly on the auto deploy, just the project name w/o domain!

For manual deploy, yes I saw in Pages you can set the nodejs_compat right in the Dashboard, but the same isn't there for Workers :(

Thanks for the assist

giuseppelt commented 1 year ago

Happy it worked.

I will update EmailFlare with new features in the future.