Astro endpoints not working on Cloudfalre Pages

I’m trying to deploy a Cloudflare Page with astro framework. I’m able to get astro endpoints to work for GET requests but not POST / PUT / DELETE. Sending a POST / PUT / DELETE request is still being received as a GET request. I think the problem is with the Cloudflare adapter. The endpoints work as expected on localhost. If I switch the adapter to Netlify, it also works on Netlify.

Below are the astro and Cloudflare adapter versions:
astro: ^2.6.4
@astrojs/cloudflare: ^6.5.0

Here’s a snippet of the endpoints:

export const get = ({ request }) => {
  return {
    body: JSON.stringify({
      message: 'This was a GET!',
    }),
  }
}

export const post = ({ request }) => {
  return {
    body: JSON.stringify({
      message: 'This was a POST!',
    }),
  }
}

Any advice? Thanks!

Did you manage to find a solution? I’ve just encountered the same issue.

They work for me: GitHub - LeanderG/cloudflare-astro-endpoints

Remember to use uppercase names for the functions GET and POST. Lowercase didn’t work for me.