Skip to content

fix: probe all regions during auth login to prevent false validation failures#135

Open
RyanLee-Dev wants to merge 1 commit into
mainfrom
fix/auth-login-region-probe
Open

fix: probe all regions during auth login to prevent false validation failures#135
RyanLee-Dev wants to merge 1 commit into
mainfrom
fix/auth-login-region-probe

Conversation

@RyanLee-Dev
Copy link
Copy Markdown
Collaborator

Summary

Closes #132.

  • auth login now probes all regions in parallel to find where the key is valid, instead of relying on a potentially stale config.baseUrl. A CN key hitting the global quota endpoint returns status_code: 2049, which was silently swallowed by a catch-all and replaced with a generic "API key validation failed" — the user had no way to diagnose the issue.
  • Original API errors are now surfaced in the failure message (e.g., global: API error: invalid api key; cn: API error: ...), plus a hint to use --verbose.
  • main.ts skips redundant region detection for auth login, since the command now handles it internally during key validation.

Test plan

  • bun test — 212 pass, 0 fail
  • Valid CN key → Testing key... Valid (cn), saves key + detected region
  • Invalid key → error shows per-region API details instead of generic message
  • --verbose shows full HTTP request/response for each region probe

…failures

Closes #132. A CN key validated against the global quota endpoint returns
status_code 2049, and the old catch-all replaced the real error with a
generic "API key validation failed" message, hiding the root cause.

Now auth login probes every region in parallel (like detectRegion) and
picks the first that succeeds; on failure the actual API errors from each
region are surfaced. The main.ts region-detection step is skipped for
auth login since the command handles it internally.
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.

MMX show API key validation failed

1 participant