Email worker, with fetch, sending to API

I am trying to set up a catch-all email, and send all incoming emails to a worker.
The work is to send the email to my API. the API will then handle the rest.
Right now, I am getting rejected emails that the address dose not exist.
While editing the worker, I noticed "Error: No fetch handler!"
export default {
  async email(message, env, ctx) {
    const response = await fetch('https://api.domain.tld', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({email:message}),
    });
    if (!response.ok) {}
    const data = await response.json();
  }
}
Was this page helpful?