Skip to content

Fix AuthProfile deserialization for social login profiles#3704

Open
syedair wants to merge 1 commit intoaws:mainfrom
syedair:fix/auth-profile-deserialization
Open

Fix AuthProfile deserialization for social login profiles#3704
syedair wants to merge 1 commit intoaws:mainfrom
syedair:fix/auth-profile-deserialization

Conversation

@syedair
Copy link
Copy Markdown

@syedair syedair commented Mar 29, 2026

Summary

  • Adds #[serde(alias = "profileName")] to AuthProfile.profile_name so it deserializes correctly from both snake_case and camelCase JSON
  • Adds unit tests for both deserialization formats

Problem

The wrapper binary (q_cli/fig_auth) writes the auth profile to the database with camelCase:

{"arn":"...","profileName":"Social_Default_Profile"}

But AuthProfile in chat-cli expects snake_case (profile_name), causing get_auth_profile() to fail with:

Failed to get auth profile: missing field `profile_name` at line 1 column 114

This results in profileArn being None, which triggers the lazy ListAvailableProfiles fallback. When that also fails (returns empty for social auth tokens), users see:

profileArn is required but no profiles are available. Please log in and select a profile.

Debug log (KIRO_LOG_LEVEL=debug KIRO_CHAT_LOG_FILE=/tmp/debug.log) confirms this:

ERROR chat_cli::api_client: 350: Failed to get auth profile: missing field `profile_name` at line 1 column 114
INFO  chat_cli::api_client: 194: profileArn missing, attempting lazy resolution via list_available_profiles

Verification

Running the chat binary directly after manually fixing the JSON to "profile_name" confirms chat works. The #[serde(alias)] fix makes this automatic.

Test plan

  • Unit tests pass for both profile_name and profileName JSON formats
  • Social/Google login users can send chat messages without the profileArn error
  • Builder ID and IAM Identity Center login flows remain unaffected

Fixes #3703

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 aws#3703
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.

Can't login with Google account (Kiro Pro+ subscription) - "profileArn is required but no profiles are available" after successful login

1 participant