digidem / comapeo-mobile

The next version of Mapeo mobile
GNU General Public License v3.0
5 stars 0 forks source link

Improve handling of secure storage errors #370

Open achou11 opened 1 month ago

achou11 commented 1 month ago

Not sure if this is a dev-only issue, but I run into this occasionally:

WARN  Possible Unhandled Promise Rejection (id: 0):
Error: Call to function 'ExpoSecureStore.getValueWithKeyAsync' has been rejected.
→ Caused by: Could not decrypt the value for key '__RootKey' under keychain 'key_v1'. Caused by: Could not decrypt the value with provided keychain

Causes the app to stop and essentially is stuck on the splash. typically clearing storage/reinstalling works.

we should be more defensive and surface a more actionable error (if it's actually an issue).

offending line (basically need to catch and do something with it): https://github.com/digidem/comapeo-mobile/blob/67275a91ee85854f0ba6c771f430868ee0307261/src/frontend/initializeNodejs.ts#L11

achou11 commented 1 month ago

potentially related issue: https://github.com/expo/expo/issues/23426

achou11 commented 1 month ago

the secure storage error is a persistent problem (on my Pixel 6 Android 14), which results in me having to clear app data every time i build the app (usually in development). a little worried that this could be an issue when we build releases, so may need some thoughtful handling 🤔

CDFN commented 1 month ago

Probably worth checking if it's not related to backend dying in background. Had similar thing happen to me few times (being stuck in splash screen) and when I logged backend status it was not started, hence splash screen was not hiding. It seems to happen very randomly, but is quite reproducible when live reloading app (pressing r in expo console). Might be worth looking into too.

achou11 commented 1 month ago

Probably worth checking if it's not related to backend dying in background. Had similar thing happen to me few times (being stuck in splash screen) and when I logged backend status it was not started, hence splash screen was not hiding. It seems to happen very randomly, but is quite reproducible when live reloading app (pressing r in expo console). Might be worth looking into too.

ah interesting! that's a good thing to confirm (didn't really think about that). will give that a look next