Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show specific error messages on errors creating the tunnel. Fixes #972 #1302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

metadaddy
Copy link

As described in #972, when creating a tunnel, cloudflared shows a somewhat cryptic error message on HTTP errors such as 429 (too many requests), since RunQuickTunnel() tries to parse the HTTP response body as JSON no matter the response status code.

This change detects non-200 status codes, shows a specific error for 429, and reports the status code for other HTTP errors.

Tests are included, and all existing and new tests pass.

Copy link

gitguardian bot commented Jul 30, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@metadaddy
Copy link
Author

I used old output from curl -X POST https://api.trycloudflare.com/tunnel as test data, which GitGuardian flagged, so I substituted clearly fake data, apart from the UUID. I'm not sure why GitGuardian is still complaining!

@metadaddy metadaddy force-pushed the improve-messages-on-create-tunnel-errors branch from 3d7cf85 to 962b8fb Compare August 2, 2024 16:50
@metadaddy
Copy link
Author

I removed the commit containing secret-looking test data and now GitGuardian is happy.

@metadaddy
Copy link
Author

@DevinCarr Hi Devin - you seem to have been active in this part of cloudflared recently. Could I get a review on this PR? Thanks!

Copy link

@GoncaloGarcia GoncaloGarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this, I left a small comment, but looks good otherwise

cmd/cloudflared/tunnel/quick_tunnel_test.go Show resolved Hide resolved
@chungthuang
Copy link
Contributor

Hi @metadaddy, thank you for making this contribution. We made a change to the quick tunnel file recently. Can you rebase?

@metadaddy metadaddy force-pushed the improve-messages-on-create-tunnel-errors branch from 962b8fb to 6b8e0e2 Compare October 1, 2024 17:01
@metadaddy
Copy link
Author

@chungthuang Rebased and force-pushed.

@GoncaloGarcia Apologes - I missed your comment when you sent it. I added the HTTP response body to the error message as you requested.

@metadaddy metadaddy force-pushed the improve-messages-on-create-tunnel-errors branch from 6b8e0e2 to d3a6ed9 Compare October 20, 2024 22:55
@metadaddy
Copy link
Author

@chungthuang / @GoncaloGarcia / @kornelski - I noticed that quick_tunnel.go had changed, so I rebased again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants