From d7ad4306ce6519c2e2e36c3b29adbfd35e7b40c5 Mon Sep 17 00:00:00 2001 From: Syed Humair Date: Sun, 29 Mar 2026 12:44:10 +0500 Subject: [PATCH] Fix AuthProfile deserialization for social login profiles The wrapper binary writes the auth profile with camelCase field names ("profileName") but AuthProfile expects snake_case ("profile_name"), causing deserialization to fail silently. This results in a missing profileArn when sending chat requests, producing the error: "profileArn is required but no profiles are available" Add #[serde(alias = "profileName")] to accept both formats. Fixes #3703 --- crates/chat-cli/src/database/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/chat-cli/src/database/mod.rs b/crates/chat-cli/src/database/mod.rs index 8640e034e..10287b3b3 100644 --- a/crates/chat-cli/src/database/mod.rs +++ b/crates/chat-cli/src/database/mod.rs @@ -86,6 +86,7 @@ pub struct CredentialsJson { #[derive(Clone, Debug, Deserialize, Serialize)] pub struct AuthProfile { pub arn: String, + #[serde(alias = "profileName")] pub profile_name: String, } @@ -669,6 +670,20 @@ mod tests { store.delete_secret(key).await.unwrap(); } + #[test] + fn test_auth_profile_deserialization_snake_case() { + let json = r#"{"arn":"arn:aws:codewhisperer:us-east-1:123456:profile/TEST","profile_name":"TestProfile"}"#; + let profile: AuthProfile = serde_json::from_str(json).unwrap(); + assert_eq!(profile.profile_name, "TestProfile"); + } + + #[test] + fn test_auth_profile_deserialization_camel_case() { + let json = r#"{"arn":"arn:aws:codewhisperer:us-east-1:123456:profile/TEST","profileName":"TestProfile"}"#; + let profile: AuthProfile = serde_json::from_str(json).unwrap(); + assert_eq!(profile.profile_name, "TestProfile"); + } + #[tokio::test] #[ignore = "not on ci"] async fn secret_delete() {