facing the issue “An unexpected error occurred when writing to SecureStore” After upgrade to SDK 33
the issue is occurred on Android only, for iOS is working
Hey @dsouksavatd,
Can you share the relevant code that’s throwing this error? Ideally in the form of a Snack, but a code snippet would suffice.
Cheers,
Adam
import * as SecureStore from 'expo-secure-store';
_onLogin = async () => {
try {
SecureStore.setItemAsync('EMAIL', 'dsouksavatd@gmail.com');
} catch(error) {
throw(error);
}
I get the same error via sentry for some users.
There were 2 errors encountered while processing this event
- exception.values.0.stacktrace.frames : Discarded invalid value Expand
- trimHeadFrames : Discarded unknown attribute
All errors by Android v.21 and Android v.22
We get the same error for one Android device (SM-N920C) v.22/5.11
Using:
await SecureStore.setItemAsync(‘token’, jwt);
Hey all,
If any of you are able to create a reproducible example of this error, would you mind creating a Github issue for it?
Cheers,
Adam
Hi,
Any news? It’s with any simple securestore call it crashes. SO I still have user experienced error on register to my app when i call SecureStore, only on android 21 & 22
Really annoying
It’s hard to help without a reproducible example. Is there a chance your value is over the limit? Size limit for a value is 2048 bytes
well, I’ve checked value is under 2048 bytes for sure, its hard to find error source because its only response a single line of message not much details even I have look at source code from https://github.com/expo/expo/blob/master/android/versioned-abis/expoview-abi31_0_0/src/main/java/abi31_0_0/host/exp/exponent/modules/api/SecureStoreModule.java but I find a temporary solution by using Platform.os == ‘ios’ ? SecureStore.setItemAsync(“value”) : AsyncStorage.setItem(“value”) its work fine
I have plenty of secure store use in my app, but i think no one is working right now for android 21 / 22, and I can’t really try without same old phone on android 21 / 22.
Sentry rapport error :
Datas are definitively under 2048 bytes, the longest one is a 100 character long token
First thing in my app, I check internet ans set item:
NetInfo.isConnected.fetch().then(isConnected => {});
function handleFirstConnectivityChange(isConnected) {
if (isConnected) _updateNetInfoStatus('online')
else _updateNetInfoStatus('offline')
}
NetInfo.isConnected.addEventListener(
'connectionChange',
handleFirstConnectivityChange
);
_updateNetInfoStatus = async (val) => {
await SecureStore.setItemAsync('netinfo_status', val);
};
This is breaking at the start i think, I’ll try to avoid the SecureStore for android 21 / 22
But I don’t really think it’s a good solution.
Never had this error until I upgraded to the sdk 33 also.
Maybe some stuffs have changed for the new 64 bits support, and something broke this for android 21/22.
Anyway,
SUGGESTION :
i didn’t find anything about this in expo, but it will be cool to put in app.json a minimum sdk version flag for android like :
"android" : {
"miniSdkVersion: 23"
}
(It would solved the problem by the meantime (by exclude old android) )
Thanks
Aha, it doesn’t work, it’s a suggestion of a thing that would be cool in expo ^^
Sorry for the misunderstanding
I have the same issue on Android 22. I’ll try excluding this Android version like suggests @ncailleux
How is that possible, as i said, it’s a thing i made up, i don’t think it’s a flag that can work damn
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.