Skip to content

Commit 353dd84

Browse files
committed
fix: use /subscriptions endpoint for Cloud auth testing
The /account endpoint doesn't exist in Redis Cloud API v1. Using /subscriptions instead which is a documented endpoint that all Cloud accounts should have access to. Fixes authentication testing in the setup wizard.
1 parent af873b9 commit 353dd84

File tree

1 file changed

+15
-9
lines changed
  • crates/redisctl/src/commands

1 file changed

+15
-9
lines changed

crates/redisctl/src/commands/auth.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,24 @@ async fn test_cloud_auth(profile: &Profile, result: &mut serde_json::Value) -> R
124124
.build()
125125
.context("Failed to create Cloud client")?;
126126

127-
match client.get_raw("/account").await {
128-
Ok(account_info) => {
127+
// Use /subscriptions endpoint to test authentication
128+
// This is a documented endpoint that should exist for all Cloud accounts
129+
match client.get_raw("/subscriptions").await {
130+
Ok(subscriptions_data) => {
129131
tests.insert("api_connectivity".to_string(), json!(true));
130132
tests.insert("authentication".to_string(), json!(true));
131133

132-
// Extract account details if available
133-
if let Some(obj) = account_info.as_object() {
134-
if let Some(id) = obj.get("id") {
135-
tests.insert("account_id".to_string(), id.clone());
136-
}
137-
if let Some(name) = obj.get("name") {
138-
tests.insert("account_name".to_string(), name.clone());
134+
// Extract subscription count if available
135+
if let Some(subscriptions) = subscriptions_data.get("subscriptions")
136+
&& let Some(arr) = subscriptions.as_array()
137+
{
138+
tests.insert("subscription_count".to_string(), json!(arr.len()));
139+
140+
// If there are subscriptions, show the first one's name
141+
if let Some(first) = arr.first()
142+
&& let Some(name) = first.get("name")
143+
{
144+
tests.insert("first_subscription".to_string(), name.clone());
139145
}
140146
}
141147

0 commit comments

Comments
 (0)