wrangler tail --version-id does not show any logs
I am trying to look at logs for a specific Worker version that is not yet deployed (to debug/validate before going live) and tried using
However it never shows any logs. All I see is:
I copy pasted the version from the cloudflare dashboard to be sure. I also tried the preview alias I am using on that version in place of
<version> but same (and no error).
The worker has worker logs enabled. In the dashboard I can see the logs for the deployed version (but only that one).
Any ideas?
Thanks,
Alex6 Replies
You can’t tail logs for a non deployed version/preview:
https://developers.cloudflare.com/workers/configuration/previews/
Cloudflare Docs
Preview URLs
Preview URLs allow you to preview new versions of your project without deploying it to production.
Feels like we could do a better job here indicating such in wrangler 😅
What you could do is a gradual rollout with 100% of your live version and 0% of the version you want to test, and use the version override header to force your previewed version:
https://developers.cloudflare.com/workers/configuration/versions-and-deployments/gradual-deployments/?utm_source=chatgpt.com#version-overrides
But yeah if you’re using the preview url, you straight up won’t get logs
Cloudflare Docs
Gradual deployments
Incrementally deploy code changes to your Workers with gradual deployments.
ok thanks. It is weird that
wrangler tail even has a --version-id argument then 😄
my workaround was to temporarily add a response header with the information I wanted to log/debugWell if you’re using gradual rollouts then you can have multiple versions deployed. Glad you got it working!
Ok. It would be great to clarify that in the documentation of eg.
wrangler tail. That it only works if the version is deployed as part of a gradual rollouts. But no logs for versions that have been just uploaded and accessed via the version url or a preview alias.