Skip to content
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

Error: Invalid Adapter: asyncstorage #171

Open
adaboubvincent opened this issue Aug 25, 2023 · 2 comments
Open

Error: Invalid Adapter: asyncstorage #171

adaboubvincent opened this issue Aug 25, 2023 · 2 comments

Comments

@adaboubvincent
Copy link

adaboubvincent commented Aug 25, 2023

I updated my expo version from 47 to 49 and I get this error after execution.

Error: Invalid Adapter: asyncstorage, js engine: hermes
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\expo\build\errors\ExpoErrorManager.js:null in createErrorHandler
at node_modules\expo\build\errors\ExpoErrorManager.js:null in
at node_modules@react-native\js-polyfills\error-guard.js:null in ErrorUtils.applyWithGuard
at node_modules\metro-runtime\src\polyfills\require.js:null in guardedLoadModule
at http://192.168.1.137:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:null in metroRequire
at http://192.168.1.137:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:null in global

The code :

import React, { useContext } from 'react';
import PouchDB from 'pouchdb-react-native';
import PouchAuth from 'pouchdb-authentication';
import PouchAsyncStorage from 'pouchdb-adapter-asyncstorage';
import { storeData } from './storageManager';

PouchDB.plugin(PouchAuth);
PouchDB.plugin(require('pouchdb-upsert'));
PouchDB.plugin(require('pouchdb-find'));

PouchDB.plugin(PouchAsyncStorage);

let LocalDatabase = new PouchDB('db_name', {
adapter: 'asyncstorage',
});

@RaghavGurjar
Copy link

RaghavGurjar commented Oct 12, 2023

same issue please solution

@VigneshmoorthyK
Copy link

Yeah it seems to be the asyncstorage has been removed from react-native latest versions.
AsyncStoragePouch.valid = () => { try { return require('@react-native-async-storage/async-storage').default !== null } catch (error) { return false } }
quick fix change the asyncstorage from react-native to @react-native-async-storage/async-storage
node_modules/pouchdb-adapter-asyncstorage/src/index.js then run npx patch-package pouchdb-adapter-asyncstorage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants