Pages local development with Wrangler - Static assets in /dist and Functions in /functions - How to

I'm looking to debug a Pages Function locally using Wrangler. The wrangler pages dev [directory] command takes in the dir containing the static Pages assets, which are compiled to /dist in my case, however in doing so, it does not see the /functions dir since it's outside of /dist. This folder structure deploys successfully to Cloudflare, however I can't figure out how to get it running locally. I wasn't able to see any commands that I can point to the /functions directory. I also wasn't able to find anything in the Pages documentation. Any help?
2 Replies
James
James3mo ago
The functions dir is relative to wherever you run the command. So if you're in a folder named foo that contains dist and functions, running wrangler pages dev dist should work as expected.
xrvo
xrvo3mo ago
I get a 404 Not Found from Wrangler unfortunately. Whereas the script works when deployed to Cloudflare. Is there any way to get diagnostics from Wrangler about this? I found the temporary files from wrangler in .wrangler/tmp/pages-7ujKnp and saw it did recognize the roure and function I have. This confirms wrangler did properly instatiate my Functions locally.