© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•8mo ago•
3 replies
CheeseyPatrick

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.

export default {
  async email(message, env, ctx) {
    try {
      // Extract email data
      const emailData = {
        to: message.to,
        from: message.from,
        subject: message.headers.get('subject'),
        timestamp: new Date().toISOString(),
        headers: Object.fromEntries(message.headers),
        // Get the email content
        content: {
          text: await message.text(),
          html: await message.html()
        }
      };

      // Forward email data to API
      const response = await fetch("my site", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${env.API_KEY}`,
        },
        body: JSON.stringify(emailData)
      });

      if (!response.ok) {
        console.error(`API request failed: ${response.status} ${response.statusText}`);
      }
      
    } catch (error) {
      console.error("Error processing email:", error);
    }
  }
}
export default {
  async email(message, env, ctx) {
    try {
      // Extract email data
      const emailData = {
        to: message.to,
        from: message.from,
        subject: message.headers.get('subject'),
        timestamp: new Date().toISOString(),
        headers: Object.fromEntries(message.headers),
        // Get the email content
        content: {
          text: await message.text(),
          html: await message.html()
        }
      };

      // Forward email data to API
      const response = await fetch("my site", {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "Authorization": `Bearer ${env.API_KEY}`,
        },
        body: JSON.stringify(emailData)
      });

      if (!response.ok) {
        console.error(`API request failed: ${response.status} ${response.statusText}`);
      }
      
    } catch (error) {
      console.error("Error processing email:", error);
    }
  }
}


Sorry in advance if this is some kind of error that is very easy to fix. I am new to Cloudflare
image.png
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

handler does export fetch() function
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
FetchError [ERR_NO_HANDLER]
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Binding outside of the fetch handler?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
17mo ago
POST method is not working in fetch inside Queue Handler
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
13mo ago