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 - Can't sync my localDB with a couch DB in my RN project #104

Open
paulbx81 opened this issue Jul 31, 2018 · 7 comments
Open

Error - Can't sync my localDB with a couch DB in my RN project #104

paulbx81 opened this issue Jul 31, 2018 · 7 comments

Comments

@paulbx81
Copy link

Issue

I tried to sync my localDB with a couch DB which is installed into my computer and it work perfectly.

Now i want to do it with a couch DB which is installed into a server.

so i use this code :

    db.sync('https://'userID':'userPASS'@'serverIP':6984/DBname', {
      live: true
    }).on('change', function (change) {
      console.log(change);
    }).on('error', function (err) {
      console.log(err);
    }).on('complete', function (info) {
      console.log(info);
    });
  }

THIS CODE WORK PERFECTLY WHEN I USE IT INTO WEB PROJECT IN INDEX.HTML
but if i use it in my react-native project i have this issue in JS debugger :

CustomPouchError {
    status: 0, name: "unknown",
    message: "getCheckpoint rejected with ",
    result: {…}
}

Info

  • React-Native
  • Windows 10

Reproduce

    db.sync('https://'userID':'userPASS'@'serverIP':6984/DBname', {
      live: true
    }).on('change', function (change) {
      console.log(change);
    }).on('error', function (err) {
      console.log(err);
    }).on('complete', function (info) {
      console.log(info);
    });
  }
@paulbx81
Copy link
Author

paulbx81 commented Aug 2, 2018

@stockulus

@jwheat
Copy link

jwheat commented Aug 7, 2018

I had this exact issue this week. I got closer by importing pouchdb-authentication

https://github.com/pouchdb-community/pouchdb-authentication

It successfully connects and I can dump the remote docs to the console, but I can't get a local db in my RN app to sync with the remote db, it red-screens.

I submitted an issue here ( pouchdb-community/pouchdb-authentication#241 )

I'll keep you posted if I figure it out and if you get it to work, please let me know too, I'd appreciate it.

@paulbx81
Copy link
Author

paulbx81 commented Aug 8, 2018

it work now, the problem was : i didn't have a REAL SSL Certificate for my https.
I don't use pouchdb-authentication. When we want to call a couchDB in other domain, it's necessary to enable CORS in this couchDB and to have a real ssl certificate for using HTTPS and not HTTP

@jwheat
Copy link

jwheat commented Aug 8, 2018

Are you still using your server's IP address in the RN code in the sync command, or did you change it to the domain name in your cert? BTW, curious, who did you use for your new SSL cert?

and are you using pouchdb-react-native ?

Sorry for all the questions

@paulbx81
Copy link
Author

paulbx81 commented Aug 8, 2018

i change it to my domain name with https
And yes i use pouchdb-react-native

@mqtik
Copy link

mqtik commented Jan 20, 2019

So it's the problem solved?

@santi8194
Copy link

it work now, the problem was : i didn't have a REAL SSL Certificate for my https.
I don't use pouchdb-authentication. When we want to call a couchDB in other domain, it's necessary to enable CORS in this couchDB and to have a real ssl certificate for using HTTPS and not HTTP

Im trying to test with local host using http, Do I have to use https?

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

4 participants