From 2768ac5f0c76c5cb1738c8ae83cbd8e5ecd006b1 Mon Sep 17 00:00:00 2001 From: Jim Lerza Date: Wed, 15 May 2024 11:21:43 -0400 Subject: [PATCH] 10361: only call admin-disable-user if we were able to find the user's cognito id --- scripts/user/disable-cognito-user.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/user/disable-cognito-user.sh b/scripts/user/disable-cognito-user.sh index f7d8897e519..ee3ad50c5ca 100644 --- a/scripts/user/disable-cognito-user.sh +++ b/scripts/user/disable-cognito-user.sh @@ -23,4 +23,6 @@ USER_COGNITO_ID=$(aws cognito-idp list-users --user-pool-id "$COGNITO_USER_POOL" | tr -d '"' \ ) +[[ -z "$USER_COGNITO_ID" ]] && echo "No user found with the provided custom:userId" && exit 1 + aws cognito-idp admin-disable-user --user-pool-id "$COGNITO_USER_POOL" --username "$USER_COGNITO_ID"