简体   繁体   中英

Unable to replicate database in pouchDB

I'm trying a react native application using couchDB 2.1.1. PouchDB entry in package json looks like this:

"pouchdb": "^6.3.4",
"pouchdb-react-native": "^6.3.4",

Replication is as shown below:

const localDB = new PouchDB('employee');
const remoteDB = new PouchDB('http://username:password@localhost:5984/employee');

localDB.replicate.from(
  remoteDB,
  (err, response) => {
    if (err) {
      return console.log(err);
    }
  },
);

I get following error:

{"code":"ETIMEDOUT","status":0,"result":{"ok":false,"start_time":"...","docs_read":0,"docs_written":0,"doc_write_failures":0,"errors":[],"status":"aborting","end_time":"...","last_seq":0}}

Almost all the times this works fine when I run the app in debug mode. Tried ajax timeout as shown here PouchDB ETIMEDOUT error . This didn't work. Is there something that I'm supposed to look in my code? Please help.

Had the same issue, the following fixed it for me:

  1. Use your PC ip address instead of localhost
  2. Configure your firewall to allow connections on port 5984 OR just disable it (Not recommended)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM