Repository navigation
Support self-hosted CloudBeat on closed networks in the wizard - #50
Merged
Merged
Conversation
- new error code connection_failed when the API URL cannot be reached (DNS, port, firewall/proxy, TLS certificate), for login, whoami and project commands; 401 from project commands is now reported as invalid_api_key - whoami and login failures include the apiBaseUrl that was used, so the wizard can show it without reading the config file (it holds the API key) - wizard: on connection_failed, explain the cause and ask the instance question again (cloud / self-hosted / keep the current URL); always pass --apiBaseUrl to login; /cloudbeat-sync uses the same connect procedure - wizard: prefer the project's CLI (npx --no -- cloudbeat-cli), then a global install, and download with npx -y @cloudbeat/cli only as the last resort - README: per-project installation for closed networks, self-hosted login, certificate and proxy settings, error codes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
romovs
self-requested a review
October 21, 2026 16:05
romovs
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
An enterprise customer with a self-hosted CloudBeat on a closed network can only run
npm i(from an internal registry). Two problems with the setup wizard there:not_logged_in/invalid_api_key. A stored URL that can't be reached (wrong host or port, VPN, proxy, company certificate) returned the genericerror, and the wizard had no path for it, so the user was stuck.cloudbeat-cli, then fell back tonpx -y @cloudbeat/cli, which downloads from the npm registry and fails without internet access.What changes
CLI
connection_failedwhen the API can't be reached at all (no HTTP response): DNS, port, firewall/proxy, TLS certificate. Used bylogin,whoamiand theprojectcommands. The API client keeps only the message of the underlying error, so detection matches the message (isConnectionError/apiErrorCodeinsrc/lib/output.ts).whoamiandloginfailures now includeapiBaseUrl, the URL that was used (fornot_logged_in, the URL a login would use). The wizard can show it, or offer to keep it, without reading~/.cloudbeat/config.json, which contains the API key.Could not connect to <url>: <reason>instead ofStored credentials are not valid: ....Wizard (
questions/01-connect.md,reference/cli.md,/cloudbeat-sync)npx --no -- cloudbeat-cli, fromdevDependencies, works offline), then a global install, andnpx -y @cloudbeat/clionly as the last resort. The--is needed:npx --no cloudbeat-cli --versionprints npm's own version.connection_failed: explain the cause (DNS / port / firewall-VPN-proxy viaHTTPS_PROXY/NO_PROXY/ company certificate authority viaNODE_EXTRA_CA_CERTS, never by disabling TLS checks), then ask the instance question again with a third option, "keep<apiBaseUrl>". With a key already stored, no new login is needed once the network is fixed.--apiBaseUrl. Without it,loginreuses the previously stored URL, so choosing "cloud" after a self-hosted login silently stayed on the self-hosted server./cloudbeat-syncuses the same connect procedure instead of a bare! cloudbeat-cli login.README: per-project installation for closed networks, self-hosted login, certificate and proxy settings, list of error codes.
Compatibility
Additive for
login/whoami(new code plus extra field).project create/status/syncused to returnerrorfor every API failure. They now returninvalid_api_keyfor HTTP 401 andconnection_failedwhen the server is unreachable. A script that matchedcode: "error"on those would see the new codes. Suggest releasing as 5.1.0. The version isn't bumped in this PR.Testing
npm test: eslint plus 45 tests, all passing.test/unit/output.test.js: error classification for 401, network and TLS messages, other HTTP errors.cli.test.js:whoamireturnsconnection_failedwithapiBaseUrl; aloginto an unreachable URL fails without touching the stored credentials;not_logged_inreports the URL a login would use.init --agent claude, plus a stored key pointing at an unreachable URL./cloudbeatin Claude Code found the project CLI vianpx --no -- cloudbeat-cliand explained theECONNREFUSEDfailure. It offered cloud / self-hosted / keep URL, noted that no new login is needed for "keep", and didn't read the config file.Note:
.husky/pre-commitisn't executable in the repo, so the hook is skipped on commit (git prints a hint). Lint was run throughnpm test.🤖 Generated with Claude Code