Function does not work on deploy (Astro)

I have been reading both the Astro and Cloudflare docs, but I can't solve my problem.

I am trying to print to console on a button press with a Cloudflare function. When using npx wrangler pages dev -- npm run dev it does work, but when deployed I get <empty string> in the console and a 404 in the Network tab, even though I can see the functions directory builds (or at least builds without error) correctly. The Cloudflare function logs do not pick up any activity.

What am I doing wrong?

// ASTRO CONFIG
export default defineConfig({
  integrations: [tailwind({
    applyBaseStyles: true
  }), react()],
  output: "server",
  adapter: cloudflare({
    mode: "directory"
  }),
});


// CLOUDFLARE ROUTING CONFIGURATION IN CONSOLE

{
  "routes": [
    {
      "routePath": "/helloworld",
      "mountPath": "/",
      "method": "",
      "module": [
        "helloworld.js:onRequest"
      ]
    },
    {
      "routePath": "/:path*",
      "mountPath": "/",
      "method": "",
      "module": [
        "[[path]].js:onRequest"
      ]
    }
  ],
  "baseURL": "/"
}
Was this page helpful?