© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3y ago•
1 reply
Kaner

Worker fetch returns unexpected 404

I'm trying to execute a simple fetch to my domain (domain.com) but it responds with 404. I'm desperate and really need help.

1. Yes, the page, domain and url is accessible.
2. Tried and tested almost everything comes to mind first (ssl, typo, cors, http method etc.)
3. Worker can actually do fetch, i tried changing url to webhook.site
4. domain.com can receive fetch, you can also try.
5. Deleted and recreated the worker
6. Works even redirecting the fetch to my localhost using ngrok

Here is my worker:
async email(event: ForwardableEmailMessage) {
        const rawEmail = await streamToArrayBuffer(event.raw, event.rawSize);
        const parser = new PostalMime();
        const parsedEmail = await parser.parse(rawEmail);

//works if i change the url anything but payload.email
        const res = await fetch('https://domain.com/api/inbound/', { 
            body: JSON.stringify(parsedEmail),
            headers: { 'Content-Type': 'application/json' },
            method: 'POST',
        });

        console.log(await res.status);  //404
}
async email(event: ForwardableEmailMessage) {
        const rawEmail = await streamToArrayBuffer(event.raw, event.rawSize);
        const parser = new PostalMime();
        const parsedEmail = await parser.parse(rawEmail);

//works if i change the url anything but payload.email
        const res = await fetch('https://domain.com/api/inbound/', { 
            body: JSON.stringify(parsedEmail),
            headers: { 'Content-Type': 'application/json' },
            method: 'POST',
        });

        console.log(await res.status);  //404
}

i'm out of ideas to try so any ideas would really help, thanks in advance.
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

Worker to Worker fetch
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
worker edit - 404
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
Unexpected Cloudflare Worker Region
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
8mo ago
Scheduled Worker - Unexpected 429s
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
10mo ago