I’m loving the simplicity of cloudflare pages logs, but am getting a bit stuck with tracking down errors that happen when running in production, but that don’t seem to have a problem when running in the local wrangler/miniflare instance.
How does one view the logs from CloudFlare pages functions? I know wrangler tail works for workers, but Pages Functions don’t appear as normal workers (even thought they use workers behind the scenes) and there’s no access from the dashboard or wrangler to see them.
There’s unfortunately no way yet to see logs for Pages Functions. Your best option is to try locally with wrangler pages dev (though it sounds like that won’t help here), or ship off the logs manually to an external service, via waitUntil.
If you jump into the Developers Discord, I know a lot of folks have similar questions and the team is working on it. https://workers.community
For now, I ended up wrapping things in a try...catch in the handler function and piping out errors as 500’s with the error message in the body. I’ll probably tie that up with a middleware error handling function at some point that does something similar.