Comments (5)
Hey @losh11, could you create a repro for this issue? I've been having trouble reproducing it. Also, not sure if this is related, but redux-persist 6.0.0 is a fairly recent release. Did you notice it before upgrading that package?
from redux-persist-sensitive-storage.
Our team just ran into this exact same issue, so I used Reactotron to diagnose what is going on. Turns out that a few seconds after sending the app to the background, the following error is thrown:
Then when bringing the app to the foreground, Reactotron shows an empty payload for the persist/REHYDRATE
action, indicating that the state wasn't persisted correctly.
I can also confirm that switching to @react-native-community/async-storage
fixes the issue.
from redux-persist-sensitive-storage.
@richeterre Thanks for the excellent detective work! From this error message, it looks as though react-native-sensitive-info is not being allowed to write to the secure storage after the application has been sent to the background.
It's been a couple of years since I spent any significant time in this codebase, but if I'm remembering correctly, redux-persist will attempt to persist the Redux store whenever the store updates.
I'm wondering if your application dispatches an action as it goes into the background, which triggers redux-persist to attempt to persist the store, but that is now failing because the OS isn't allowing the secure storage to be written by a background application? This is all just speculation on my part.
From what I can see, I don't think there's anything we can do in this library to address the issue, as we're not the ones doing the actual write to the secure storage area. That part is handled by react-native-sensitive-info, so perhaps you could report this issue to that project to see if they've got any insight that might help.
If you disagree and think there is something we can do here, please re-open and let us know what that might be.
from redux-persist-sensitive-storage.
@losh11 @richeterre One more thing: it would probably be worth mentioning whether this issue happens on iOS, Android, or both (and which versions of the OS) when you open the issue on react-native-sensitive-info. Perhaps this is new behavior with iOS 13?
from redux-persist-sensitive-storage.
Thanks @randycoulman for your detailed response! I had already suspected the same – that the issue is with react-native-sensitive-info
. I've worked around the bug for now by switching to the react-native-keychain
library and a lightweight wrapper around it.
I'm wondering if your application dispatches an action as it goes into the background, which triggers redux-persist to attempt to persist the store, but that is now failing because the OS isn't allowing the secure storage to be written by a background application?
Yes, our app does regular polling on its home screen, which continues for some time in the background until the OS shuts it down. Part of this state is included in the persisted whitelist. So that's likely the reason why the persisted store gets "corrupted" as the write eventually fails.
For me this happens on iOS (not supporting Android right now, so can't say) and it did start around the time we upgraded to iOS 13. On the other hand, we did some big React Native upgrades around the same time, so I can't say for sure what caused it.
from redux-persist-sensitive-storage.
Related Issues (20)
- Add an example of multiple storage usage HOT 1
- react-native-sensitive-info Android Keystore Fake News HOT 1
- Error storing data TypeError: Cannot read property 'setItem' of undefined HOT 1
- Improve ES6 compatibility
- README Note about android react-native-sensistive-info incompatibility incorrect HOT 2
- Losing Data on IOs HOT 2
- Why not use the secure branch? HOT 2
- Android Release fails HOT 2
- _reactNativeSensitiveInfo.default.setItem is not a function HOT 5
- How to verify it is working? HOT 1
- How to use this with android keystore?
- Key values clarification HOT 1
- Migrate pre-existing storage on first use HOT 5
- Clarification on authentication HOT 2
- Update react-native-sensitive-info to v6 HOT 3
- Will secure storage be created if configuration option is NOT passed?
- Does it work with react-native-sensitive-info v6? HOT 2
- IOS - info does not removed after app uninstalled HOT 1
- 'TypeError: (0 , _reduxPersistSensitiveStorage.default) is not a function' while running test cases
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux-persist-sensitive-storage.