cloudflare / cloudflared

Cloudflare Tunnel client (formerly Argo Tunnel)
https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide
Apache License 2.0
9.08k stars 798 forks source link

🐛'cloudflared tunnel login' does not complete #1252

Open aselunar opened 4 months ago

aselunar commented 4 months ago

Describe the bug 'cloudflared tunnel login' does not complete

To Reproduce I am trying to follow these instructions to create a tunnel from my localhost to a static domain created by cloudflare. Create a locally-managed tunnel (CLI) · Cloudflare Zero Trust docs I am stalled at the second step: ‘cloudflared tunnel login’ redirects me to ‘https://dash.cloudflare.com/argotunnel?aud=&callback=https%3A%2F%2Flogin.cloudflareaccess.org%2F_-asOzk-STJjLc3gdY23fYKlQ2LTM3PnsyDj2PGZsX8%3D’ But even after logging in on cloudflare from the browser, I still get ten messages like this: ‘Timestamp INF Waiting for login
’ Followed by ‘Failed to write the certificate due to the following error: Failed to fetch resource Your browser will download the certificate instead. You will have to manually copy it to the following path:’

However, the browser does not download the certificate. I have tried troubleshooting steps such as updating my browser or logging in with a different browser, to no avail. How do I solve this error?

If it's an issue with Cloudflare Tunnel:

  1. Tunnel ID : none. failing before that step.
  2. cloudflared config: none. failing before that step.

Expected behavior

I was expecting for cloudflared to get a certificate that would help me with the next step, 'cloudflared tunnel create', but every tunnel management command is blocked because I cannot complete the 'cloudflared tunnel login' step.

Environment and versions Apple M2 MacBook Air, macOS 14.5 cloudflared version 2024.5.0 (built 2024-05-16T14:20:06Z)

Logs and errors Other than the logs noted above there are no errors.

dharmit commented 3 months ago

@aselunar I faced same issue. In my case, I clicked on the name of the domain I had registered on cloudflare. It asked me to "Authorize" the tunnel. When I clicked on "Authorize", I was told that email verification was pending. So I did that.

Once that was done, when cloudflared tunnel login opened the browser tab, I did the authorize thing right away instead of waiting for the loop of INF Waiting for login messages to appear on stdout. And that managed to save the certificate in $HOME/.cloudflare/cert.pem.

Hope it helps. :)