fix: two-step DynamoDB update for google_accounts; live SM lookup in list_google_accounts
This commit is contained in:
@@ -205,11 +205,17 @@ def handle_callback(params: dict) -> dict:
|
||||
table_name = os.environ.get('USERS_TABLE_NAME', '')
|
||||
if table_name and actor_id:
|
||||
try:
|
||||
get_ddb().Table(table_name).update_item(
|
||||
table = get_ddb().Table(table_name)
|
||||
table.update_item(
|
||||
Key={'actor_id': actor_id},
|
||||
UpdateExpression='SET google_accounts = if_not_exists(google_accounts, :empty), google_accounts.#label = :email',
|
||||
UpdateExpression='SET google_accounts = if_not_exists(google_accounts, :empty)',
|
||||
ExpressionAttributeValues={':empty': {}},
|
||||
)
|
||||
table.update_item(
|
||||
Key={'actor_id': actor_id},
|
||||
UpdateExpression='SET google_accounts.#label = :email',
|
||||
ExpressionAttributeNames={'#label': label},
|
||||
ExpressionAttributeValues={':email': user_email, ':empty': {}},
|
||||
ExpressionAttributeValues={':email': user_email},
|
||||
)
|
||||
except Exception as e:
|
||||
print(f'[oauth] DynamoDB update failed: {e}')
|
||||
|
||||
Reference in New Issue
Block a user