Unable to test Cloudflare Page Function: [wrangler:err] Error: No response!
I have a simple static site to which I want to add a Page Function. So far, I've read the tutorials at these links to get a sense for how this works (I'm migrating from Netlify):
https://developers.cloudflare.com/pages/functions/get-started/
https://developers.cloudflare.com/pages/how-to/refactor-a-worker-to-pages-functions/
https://developers.cloudflare.com/pages/functions/typescript/
https://developers.cloudflare.com/pages/tutorials/build-an-api-with-pages-functions/
Here is what I did:
1. Installed wrangler (v3.72.2).
2. Created a
3. Created the following
4. Ran
But when I navigate to
The only way I'm able to get my function to work is if I convert it to a proper worker with a default export containing a
Are Page Functions deprecated? If not, does anyone know what I'm doing wrong?
https://developers.cloudflare.com/pages/functions/get-started/
https://developers.cloudflare.com/pages/how-to/refactor-a-worker-to-pages-functions/
https://developers.cloudflare.com/pages/functions/typescript/
https://developers.cloudflare.com/pages/tutorials/build-an-api-with-pages-functions/
Here is what I did:
1. Installed wrangler (v3.72.2).
2. Created a
functions/api/comments.ts file in my Pages project directory.3. Created the following
wrangler.toml file at the root of my Pages directory:4. Ran
wrangler dev to start up the local server.But when I navigate to
localhost:8787 (either in my browser or via curl), I get [wrangler:err] Error: No response!The only way I'm able to get my function to work is if I convert it to a proper worker with a default export containing a
fetch function as shown here:Are Page Functions deprecated? If not, does anyone know what I'm doing wrong?

