localForage: Error: No available storage method found
I am still getting an error : (node:12884) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: No available storage method found.
I’m using v1.50
Update: The error actually only occurs when using react-snapshot lib
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 17
- Comments: 23 (1 by maintainers)
Commits related to this issue
- work around UnhandledPromiseRejectionWarning errors from localforage See https://github.com/localForage/localForage/issues/722. — committed to mattermost/mattermost-webapp by lieut-data 6 years ago
- Eliminate yarn test spam (#1024) * remove "Network status set to (true|false)" message This was originally added in a bid to track down a now resolved issue, and thus is no longer needed. * wo... — committed to mattermost/mattermost-webapp by lieut-data 6 years ago
The error is still valid for SSR 😦
@salidean what do you think about such strategy?
I want to fallback to memoryDriver only when all others aren’t available
I’ve encountered this issue during unit tests that depend upon
localforage
, even with the following snippet:For the life of me I cannot find where the code is throwing, but I have a feeling the error is uncatchable without modifying the
localforage
source code.@waleedarshad you have to disable a persist reducer for the server-side rendering, something like that:
Is this a custom errorMessage? What does this error message mean? My monitoring system caught this error, but I don’t know how to reproduce it.
you can define a custom driver like
emptyLocalForageDriver
, and set it as default when window is undefined.I hit this issue when using aws amplify datastore. At one point I scoured their code and found that the root cause was that jsdom does not provide
indexeddb
. You can use https://www.npmjs.com/package/fake-indexeddb to solve this. So long as youimport 'fake-indexeddb/auto';
before the code instantiatinglocalforage
runs, it should alleviate the problem.wow, thanks @sherl0cks. This solution works for me.
It would be nice to make this error try-catchable. Our current use case is essentially
However with this setup, the above error can’t be caught.
Users disabling cookies & local storage, using private browsing, etc are all valid use cases and it would be nice to support them.