Using wrangler for local development with pages + functions
Is this supported? It appears under https://developers.cloudflare.com/pages/functions/local-development/, which implies that if you run "npx wrangler pages dev" the dev mode wrangler will find js/ts files under the
functions/ subdirectory and somehow miniflare(?) will run them as a worker at the relevant route.
But when I start it I only see "No Functions. Shimming..." in the early output of the dev server launch command every time.
I've used the helloworld.js example file from https://developers.cloudflare.com/pages/functions/get-started/. I moved the functions/ subdirectory to both the root directory and under the static assets directory, same result.1 Reply
After finding the error descriptions in https://github.com/cloudflare/workers-sdk/issues/2962, which is very applicable to the question above, I realized that of the two places to put the functions directory it should be in the current working directory the wrangler CLI launches in.
This changes the error from "No Functions. Shimming ..." to "[ERROR} No routes found when building Functions directory: ./functions - skipping"
I can't see why
./functions/helloworld.js isn't automatically considered as being route /helloworld, though.
I don't have a '_workers.js' file.
I do have a '_redirects' file (in my build output directory) as part of my current pages deployment, but if I temporarily remove it and restart it's the same 'No routes found' error.