-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Labels
authRelated to the Auth category/pluginsRelated to the Auth category/pluginsquestionGeneral questionGeneral question
Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
Language and Async Model
Kotlin, Java
Amplify Categories
Authentication
Gradle script dependencies
implementation(libs.amplify.core)
implementation(libs.amplify.auth)
implementation(libs.amplify.api)
implementation(libs.amplify.pinpoint)
implementation(libs.amplify.storage)
implementation(libs.amplify.rxbindings)
coreLibraryDesugaring(libs.desugar)amplifyVersion = "2.26.0"
Environment information
# Put output below this line
------------------------------------------------------------
Gradle 8.11.1
------------------------------------------------------------
Build time: 2024-11-20 16:56:46 UTC
Revision: 481cb05a490e0ef9f8620f7873b83bd8a72e7c39
Kotlin: 2.0.20
Groovy: 3.0.22
Ant: Apache Ant(TM) version 1.10.14 compiled on August 16 2023
Launcher JVM: 21.0.5 (JetBrains s.r.o. 21.0.5+-12932927-b750.29)
Daemon JVM: D:\Programs\Studio\jbr (no JDK specified, using current Java home)
OS: Windows 11 10.0 amd64
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
Case: We are sending a push notification to all our users. And after few sec we see in Crashlytics a lot of exceptions related to session fetch.
// Put output below this line
Non-fatal Exception: com.amplifyframework.auth.exceptions.UnknownException
Fetch auth session failed.
Caused by aws.sdk.kotlin.services.cognitoidentity.model.TooManyRequestsException: Rate exceeded
at aws.sdk.kotlin.services.cognitoidentity.model.TooManyRequestsException$Builder.build(TooManyRequestsException.kt:60)
at aws.sdk.kotlin.services.cognitoidentity.serde.TooManyRequestsExceptionDeserializer.deserialize(TooManyRequestsExceptionDeserializer.kt:35)
at aws.sdk.kotlin.services.cognitoidentity.serde.GetIdOperationDeserializerKt.throwGetIdError(GetIdOperationDeserializer.kt:59)
at aws.sdk.kotlin.services.cognitoidentity.serde.GetIdOperationDeserializerKt.access$throwGetIdError(GetIdOperationDeserializer.kt:1)
at aws.sdk.kotlin.services.cognitoidentity.serde.GetIdOperationDeserializer.deserialize(GetIdOperationDeserializer.kt:34)
at aws.sdk.kotlin.services.cognitoidentity.serde.GetIdOperationDeserializer.deserialize(GetIdOperationDeserializer.kt:29)
at aws.smithy.kotlin.runtime.http.operation.DeserializeHandler.call(SdkOperationExecution.kt:347)
at aws.smithy.kotlin.runtime.http.operation.DeserializeHandler$call$1.invokeSuspend(:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:832)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)As implementation when the app is starting we initialize the amplify:
RxAmplify.addPlugin(apiPlugin);
RxAmplify.addPlugin(new AWSCognitoAuthPlugin());
RxAmplify.addPlugin(new AWSS3StoragePlugin());
RxAmplify.addPlugin(new AWSPinpointAnalyticsPlugin());
AmplifyConfiguration configuration = AmplifyConfiguration.builder(AmplifyConfig.Companion.getInstance().getAWSConfiguration())
.devMenuEnabled(BuildConfig.DEBUG)
.build();
RxAmplify.configure(configuration, AppApplication.Companion.getInstance());and then we are calling fetch session to get the state of the session:
Disposable sessionDisposable = RxAmplify.Auth.fetchAuthSession()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(authSession -> {
AWSCognitoAuthSession session = (AWSCognitoAuthSession) authSession;
switch (session.getIdentityIdResult().getType()) {
case AuthSessionResult.Type.SUCCESS:
callback.onSuccess(session.isSignedIn(),
session.getIdentityIdResult().getValue() != null ? session.getIdentityIdResult().getValue() : "");
break;
case AuthSessionResult.Type.FAILURE:
Throwable error = session.getIdentityIdResult().getError() != null
? session.getIdentityIdResult().getError()
: new Exception("Unknown error");
callback.onFailed(error);
break;
}
}, callback::onFailed);This issue is happening only when we blast a notification and a lot of users are opening the app. On normal use all is working fine.
I don't know exacly what we should do or how we should manage this situation.
Reproduction steps (if applicable)
See Describe the bug.
Code Snippet
// Put your code below this line.Log output
// Put your logs below this line
amplifyconfiguration.json
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response
Metadata
Metadata
Assignees
Labels
authRelated to the Auth category/pluginsRelated to the Auth category/pluginsquestionGeneral questionGeneral question