Hi all 👋🏻. I'm having trouble getting a hello world with functions working locally or when deploye

Hi all 👋🏻. I'm having trouble getting a hello world with functions working locally or when deployed. Hoping I can get some guidance here.

I used a Solid JS starter project from here (https://developers.cloudflare.com/pages/framework-guides/deploy-a-solid-site/) and then added a /functions/hello.js file in the root of the project that looks like this:

export function onRequest(context) {
  return new Response("Hello, world!");
}


I expected that if I ran npx wrangler pages dev and then went to http://localhost:8788/hello I would just see "Hello, world!" but instead of that I see the 404 page of my frontend app.

I've also deployed to prod and see the same thing at "/hello". In the CF UI in the functions tab I see this in the routing config:
{
  "baseURL": "/",
  "routes": [
    {
      "method": "",
      "module": [
        "hello.js:onRequest"
      ],
      "mountPath": "/",
      "routePath": "/hello"
    }
  ]
}


and locally wrangler pages functions build works fine.

Any ideas? I'm thinking its some small basic bit of config I'm missing or maybe a misunderstanding of what a Hello World looks like?
Was this page helpful?