No fetch handler!
Hello! I am having trouble with my worker. It is an Email Worker for email routing and I am getting the error "No fetch handler!" I was wondering what this error means. I don't think it's an issue with my code, since one of the example email workers is very similar. Maybe I've set it up incorrectly? I've attached my code and the error.
Sorry in advance if this is some kind of error that is very easy to fix. I am new to Cloudflare

3 Replies
Ok. It's still working even with this error. Sorry for making this post, I feel kinda stupid. I guess this error is not something to worry about
Cloudflare Workers can be triggered in various ways.
export default { async fetch(request, env, ctx) { ... } }: This is the signature for a standard HTTP Worker. It's designed to intercept and respond to HTTP requests (e.g., from a web browser). When a request hits your worker's URL, the Cloudflare runtime looks for this fetch handler to execute.
export default { async email(message, env, ctx) { ... } }: This is the signature for an Email Worker. It's specifically designed to be triggered by incoming emails that are routed to it through Cloudflare's Email Routing service. The message object contains the email's data.
The "No fetch handler!" error occurs when your worker, which only has an email handler, receives an HTTP request. The runtime tries to find a fetch handler to process the request, doesn't find one, and consequently throws this error.
Ah, that makes sense. It looks like the little code debugger thing in the cloudflare website code editor makes a http request. Thanks for the help!