Hi all, I'm just attempted a POC, and I'm running into a couple of problems around the functions. I
Hi all, I'm just attempted a POC, and I'm running into a couple of problems around the functions.
I create a new nuxt app using the create-cloudflare CLI 'create-cloudflare nuxt3-poc-002 --framework nuxt --ts true', and I add the ./functions folder, and copied the helloworld.js file from the docs.
I ran npm run pages:dev, and navigated to localhost:3000/helloworld. The app keeps returning a 404, and not returning the expected response stated in the documentation here. https://developers.cloudflare.com/pages/functions/get-started/
Is there something I'm missing here? I assume the npm run pages:dev also hosts the functions worker as well?
EDIT:
I have created 2x POC now. One is purely the create-cloudflare built app. That returns a 200, and just returns a standard page.
I have a more advance version where I have added layouts, and pages, and that returns a 404. So I'm assuming the pages automated routes are handling/hijacking the API requests, and returning the 404... Still I would expect the pages:dev command to run the worker and proxies as it worked in the cloud.
If I take another approach, I run 'npx wrangler pages dev ./functions' within the root of the website, and it'll start hosting the functions worker on 127.0.0.1:8788.. and if I navigate to 'http://127.0.0.1:8788/helloworld' I see the results expected. So there is no problem compiling the functions code.. I assume the nuxt router is hijacking the handling of the request away from wrangler's worker hosting, and the functions logic never gets hit.
Again this doesn't make sense to me. I wouldn't want to need to make a proxy via axios or anything to get this working. As I would expect it to work out of the box as is. Since it's a create-cloudflare CLI generated project..
I really want to use the SSR features of Nuxt locally.
I create a new nuxt app using the create-cloudflare CLI 'create-cloudflare nuxt3-poc-002 --framework nuxt --ts true', and I add the ./functions folder, and copied the helloworld.js file from the docs.
I ran npm run pages:dev, and navigated to localhost:3000/helloworld. The app keeps returning a 404, and not returning the expected response stated in the documentation here. https://developers.cloudflare.com/pages/functions/get-started/
Is there something I'm missing here? I assume the npm run pages:dev also hosts the functions worker as well?
EDIT:
I have created 2x POC now. One is purely the create-cloudflare built app. That returns a 200, and just returns a standard page.
I have a more advance version where I have added layouts, and pages, and that returns a 404. So I'm assuming the pages automated routes are handling/hijacking the API requests, and returning the 404... Still I would expect the pages:dev command to run the worker and proxies as it worked in the cloud.
If I take another approach, I run 'npx wrangler pages dev ./functions' within the root of the website, and it'll start hosting the functions worker on 127.0.0.1:8788.. and if I navigate to 'http://127.0.0.1:8788/helloworld' I see the results expected. So there is no problem compiling the functions code.. I assume the nuxt router is hijacking the handling of the request away from wrangler's worker hosting, and the functions logic never gets hit.
Again this doesn't make sense to me. I wouldn't want to need to make a proxy via axios or anything to get this working. As I would expect it to work out of the box as is. Since it's a create-cloudflare CLI generated project..
I really want to use the SSR features of Nuxt locally.

