Debugging email worker catch-all

I’m trying to debug I’m having with a catch-all email worker and was wondering if anyone had any advice on what to do.
For some reason, all my emails to the worker are being dropped even though when I test the script, it shows that it should be forwarding the emails. I looked at the logs, and the status for the requests says “ok”.
Is there something I’m missing about how email forwarding is supposed to work in email workers? Is there something I need to do other than calling message.forward()? Is there any way to debug what’s happening?

Welcome to the Cloudflare Community!

Currently, all mail handled by Workers is shown as dropped, no matter if you forward it or not. Workers a lso use Delivery failed if the worker errored out, ex:


Only mail forwarded by the normal route forward action is shown as “forwarded”

Make sure you’re awaiting it

Add logging and tail the worker

Are you saying they are actually being dropped/never forwarded, or just that it shows as “Dropped” in the dashboard (which as explained above is normal)? If it’s never being forwarded, I would make sure the address you’re trying to send it to is a verified destination address under the Email Routing tab and you are awaiting the forward. Otherwise I would add logs and tail.

Thanks! That’s very helpful. I did forget to await the promise from the forward. I guess the mock object in the tester just does the logging in the function rather than returning a promise to do the logging.

I’ll test it and confirm back if it works.

1 Like

I can confirm that adding the await seems to have fixed the issue. Thanks again for your help!

It’s interesting that the example in the documentation is missing the await (see https://developers.cloudflare.com/email-routing/email-workers/runtime-api/).

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.