Skip to content

Commit af0d4c0

Browse files
fix(Auth): prevent multiple invocations of success callback for updateUserAttributes (#1339)
1 parent 969ee59 commit af0d4c0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AWSCognitoAuthPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,8 @@ public void onResult(List<UserCodeDeliveryDetails> result) {
849849
null)
850850
));
851851
}
852-
onSuccess.accept(resultMap);
853852
}
853+
onSuccess.accept(resultMap);
854854
}
855855

856856
@Override

testutils/src/main/java/com/amplifyframework/testutils/Await.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ private static <R, E extends Throwable> void await(
140140
try {
141141
resultErrorEmitter.emitTo(
142142
result -> {
143+
if (resultContainer.get() != null) {
144+
throw new RuntimeException("Result callback called more than once with result: " + result);
145+
}
143146
resultContainer.set(result);
144147
latch.countDown();
145148
}, error -> {

0 commit comments

Comments
 (0)