-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amplify configuration shared preferences are corrupted #2863
Comments
This is definitely unexpected to see. Amplify creates an installation identifier on the device in the application's sandbox (data/data//noBackup/com.amplify.credentialStore.installationIdentifier This file simply stores a randomly generated UIUD. This UUID is appended to the shared preference file I'm unsure how this has happened but the This will reset the Amplify Auth state on the device, but this should hopefully be resolvable by deleting the installationIdentifier file.
This would need to be deleted before calling I would love to hear more about how often you are seeing this issue. Has this been seen on a single device or is this something you are running to often? We have not received any other reports of this happening. |
Hi @tylerjroach, Thank you for your response. Could you help us identify where we can catch this exception?
If this exception occurs, it doesn't seem to be caught in the catch block. |
This appears to be an edge case that hasn't been accounted for and is not catchable at the moment. Can you please provide more information on how many times you have seen this crash occur. I don't quite understand how the library is even getting into this point.
For your reproduction steps, can you replicate this issue on multiple device types or just a single device? How many times have you seen this issue happen? Are you seeing customers experience this issue in production and at what rate? |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Before opening, please confirm:
Language and Async Model
Kotlin, Kotlin - Coroutines
Amplify Categories
Authentication
Gradle script dependencies
// Put output below this line
Environment information
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
When our android device shutdown abruptly during authentication. It causing amplify credential shared preferences to get corrupted:
Below are the logs:
2024-06-28 20:01:25.135 12564-12564 App com.euphotic.sbcApp I Usb initialized
2024-06-28 20:01:25.137 12564-12564 start com.euphotic.sbcApp I Device is not locked
2024-06-28 20:01:25.139 12564-12564 App com.euphotic.sbcApp I isregistrationchecked is false
2024-06-28 20:01:25.139 12564-12564 start com.euphotic.sbcApp D db file not found
2024-06-28 20:01:25.140 12564-12564 DB_deug com.euphotic.sbcApp D isDeviceRegistered: OA
2024-06-28 20:01:25.141 12564-12564 DB_debug com.euphotic.sbcApp D getDBInstance: DI
2024-06-28 20:01:25.141 12564-12564 DB_debug com.euphotic.sbcApp D buildNitriteDB: DI
2024-06-28 20:01:25.141 12564-12564 DB_debug com.euphotic.sbcApp D buildNitriteDB: try
2024-06-28 20:01:25.262 12564-12596 AndroidRuntime com.euphotic.sbcApp E FATAL EXCEPTION: DefaultDispatcher-worker-3
Process: com.euphotic.sbcApp, PID: 12564
java.lang.IllegalArgumentException: File com.amplify.credentialStore.�+�������
5�c�FL�C/��і���mn94�-�W��.xml contains a path separator
at android.app.ContextImpl.makeFilename(ContextImpl.java:3263)
at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:915)
at android.app.ContextImpl.deleteSharedPreferences(ContextImpl.java:669)
at android.content.ContextWrapper.deleteSharedPreferences(ContextWrapper.java:218)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.deleteSharedPreferences(EncryptedKeyValueRepository.kt:118)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.openKeystoreWithDefaultMasterKey(EncryptedKeyValueRepository.kt:98)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.getOrCreateSharedPreferences(EncryptedKeyValueRepository.kt:67)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.access$getOrCreateSharedPreferences(EncryptedKeyValueRepository.kt:32)
at com.amplifyframework.core.store.EncryptedKeyValueRepository$sharedPreferences$2.invoke(EncryptedKeyValueRepository.kt:48)
at com.amplifyframework.core.store.EncryptedKeyValueRepository$sharedPreferences$2.invoke(EncryptedKeyValueRepository.kt:48)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.getSharedPreferences(EncryptedKeyValueRepository.kt:48)
at com.amplifyframework.core.store.EncryptedKeyValueRepository.get(EncryptedKeyValueRepository.kt:51)
at com.amplifyframework.auth.cognito.data.AWSCognitoAuthCredentialStore.retrieveCredential(AWSCognitoAuthCredentialStore.kt:62)
at com.amplifyframework.auth.cognito.actions.CredentialStoreCognitoActions$loadCredentialStoreAction$$inlined$invoke$1.execute(Action.kt:70)
at com.amplifyframework.statemachine.ConcurrentEffectExecutor$execute$1$1.invokeSuspend(ConcurrentEffectExecutor.kt:26)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@296787f, Dispatchers.Default]
2024-06-28 20:01:25.346 450-1345 BufferQueueDebug surfaceflinger E Application Error: com.euphotic.sbcApp#0 id info cannot be read from 'Application Error: com.euphotic.sbcApp#0'
2024-06-28 20:01:25.941 12564-12564 DB_debug com.euphotic.sbcApp D buildNitriteDB: returning
2024-06-28 20:01:26.245 12564-12564 App com.euphotic.sbcApp I repo size is 0
2024-06-28 20:01:26.246 12564-12564 App com.euphotic.sbcApp I isregistered is false
2024-06-28 20:01:26.254 12564-12564 App com.euphotic.sbcApp I Showing first fragment
2024-06-28 20:01:26.267 12564-12564 App com.euphotic.sbcApp I On Welcome fragment
2024-06-28 20:01:26.267 12564-12564 App com.euphotic.sbcApp I Finished wait
How to handle this exception. How can we clear the particular shared preference key.
Reproduction steps (if applicable)
Code Snippet
// Put your code below this line.
Log output
amplifyconfiguration.json
{
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"api": {
"plugins": {
"awsAPIPlugin": {
"nosh": {
"endpointType": "REST",
"endpoint": "https://*******.amazonaws.com/dev",
"region": "ap-south-1",
"authorizationType": "NONE"
},
"api": {
"endpointType": "REST",
"endpoint": "https://amazonaws.com/dev",
"region": "ap-south-1",
"authorizationType": "AMAZON_COGNITO_USER_POOLS"
},
"nosh_otp_dev": {
"endpointType": "REST",
"endpoint": "https://.amazonaws.com/dev",
"region": "ap-south-1",
"authorizationType": "AMAZON_COGNITO_USER_POOLS"
}
}
}
},
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"UserAgent": "aws-amplify-cli/0.1.0",
"Version": "0.1.0",
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "ap-south-1:5503a4f0-cfba-4a39-a9ca-06ef9c43b28f",
"Region": "ap-south-1"
}
}
},
"CognitoUserPool": {
"Default": {
"PoolId": "ap-south-1_jvyEjtkKf",
"AppClientId": "",
"Region": "ap-south-1"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "CUSTOM_AUTH"
}
}
}
}
}
}
GraphQL Schema
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: