Fail to replicate a local IndexedDB to a remote CouchDB using PouchDB











up vote
0
down vote

favorite













I'm using PouchDB 7.0.0 in an Ionic project (Ionic 4.0.5).



Within a provider, I define both a local and a remote database:



@Injectable()
export class DatabaseProvider {

constructor() {
this.db = new PouchDB("mydb");
this.remote = new PouchDB("http://<my_server_running_couchdb>/<remote_db_name>")

}


The local database lives in the Chrome browser as an IndexedDB instance. However, the problem also occurs in Firefox so it does not look like the browser is the guy to blame.



The remote database is initially empty and runs on CouchDB 2.1.2. It has already been created on my server with no admin or member set up, so it should be public and allow non-authenticated requests. By the way, CORS are enabled as well.



In the same provider I also define a method that triggers a replication from the local db to the remote node:



  replicateLocalDBToRemote() {
console.log("Replicating database...");
this.db.replicate.to(this.remote).then(() => {
console.log("Celebrate");
}).catch(error => {
console.error(error)
})
}


And here is what the call to replicateLocalDBToRemote throws at me



CustomPouchError {__zone_symbol__currentTask: e, result: {…}}
result:
doc_write_failures: 0
docs_read: 0
docs_written: 0
end_time: "2018-11-21T16:23:36.974Z"
errors:
last_seq: 0
ok: false
start_time: "2018-11-21T16:23:36.874Z"
status: "aborting"


and I am afraid I can't call this a self-explanatory message.



Any guess on what might be the root cause of the issue?



EDIT: After crawling through the PouchDB repo on github, I found this entry which might refer to the same problem.










share|improve this question
























  • How many documents were in your local database?
    – IanC
    Nov 23 at 8:53










  • I would say a hundred or so
    – Buddyshot
    Nov 23 at 12:06















up vote
0
down vote

favorite













I'm using PouchDB 7.0.0 in an Ionic project (Ionic 4.0.5).



Within a provider, I define both a local and a remote database:



@Injectable()
export class DatabaseProvider {

constructor() {
this.db = new PouchDB("mydb");
this.remote = new PouchDB("http://<my_server_running_couchdb>/<remote_db_name>")

}


The local database lives in the Chrome browser as an IndexedDB instance. However, the problem also occurs in Firefox so it does not look like the browser is the guy to blame.



The remote database is initially empty and runs on CouchDB 2.1.2. It has already been created on my server with no admin or member set up, so it should be public and allow non-authenticated requests. By the way, CORS are enabled as well.



In the same provider I also define a method that triggers a replication from the local db to the remote node:



  replicateLocalDBToRemote() {
console.log("Replicating database...");
this.db.replicate.to(this.remote).then(() => {
console.log("Celebrate");
}).catch(error => {
console.error(error)
})
}


And here is what the call to replicateLocalDBToRemote throws at me



CustomPouchError {__zone_symbol__currentTask: e, result: {…}}
result:
doc_write_failures: 0
docs_read: 0
docs_written: 0
end_time: "2018-11-21T16:23:36.974Z"
errors:
last_seq: 0
ok: false
start_time: "2018-11-21T16:23:36.874Z"
status: "aborting"


and I am afraid I can't call this a self-explanatory message.



Any guess on what might be the root cause of the issue?



EDIT: After crawling through the PouchDB repo on github, I found this entry which might refer to the same problem.










share|improve this question
























  • How many documents were in your local database?
    – IanC
    Nov 23 at 8:53










  • I would say a hundred or so
    – Buddyshot
    Nov 23 at 12:06













up vote
0
down vote

favorite









up vote
0
down vote

favorite












I'm using PouchDB 7.0.0 in an Ionic project (Ionic 4.0.5).



Within a provider, I define both a local and a remote database:



@Injectable()
export class DatabaseProvider {

constructor() {
this.db = new PouchDB("mydb");
this.remote = new PouchDB("http://<my_server_running_couchdb>/<remote_db_name>")

}


The local database lives in the Chrome browser as an IndexedDB instance. However, the problem also occurs in Firefox so it does not look like the browser is the guy to blame.



The remote database is initially empty and runs on CouchDB 2.1.2. It has already been created on my server with no admin or member set up, so it should be public and allow non-authenticated requests. By the way, CORS are enabled as well.



In the same provider I also define a method that triggers a replication from the local db to the remote node:



  replicateLocalDBToRemote() {
console.log("Replicating database...");
this.db.replicate.to(this.remote).then(() => {
console.log("Celebrate");
}).catch(error => {
console.error(error)
})
}


And here is what the call to replicateLocalDBToRemote throws at me



CustomPouchError {__zone_symbol__currentTask: e, result: {…}}
result:
doc_write_failures: 0
docs_read: 0
docs_written: 0
end_time: "2018-11-21T16:23:36.974Z"
errors:
last_seq: 0
ok: false
start_time: "2018-11-21T16:23:36.874Z"
status: "aborting"


and I am afraid I can't call this a self-explanatory message.



Any guess on what might be the root cause of the issue?



EDIT: After crawling through the PouchDB repo on github, I found this entry which might refer to the same problem.










share|improve this question
















I'm using PouchDB 7.0.0 in an Ionic project (Ionic 4.0.5).



Within a provider, I define both a local and a remote database:



@Injectable()
export class DatabaseProvider {

constructor() {
this.db = new PouchDB("mydb");
this.remote = new PouchDB("http://<my_server_running_couchdb>/<remote_db_name>")

}


The local database lives in the Chrome browser as an IndexedDB instance. However, the problem also occurs in Firefox so it does not look like the browser is the guy to blame.



The remote database is initially empty and runs on CouchDB 2.1.2. It has already been created on my server with no admin or member set up, so it should be public and allow non-authenticated requests. By the way, CORS are enabled as well.



In the same provider I also define a method that triggers a replication from the local db to the remote node:



  replicateLocalDBToRemote() {
console.log("Replicating database...");
this.db.replicate.to(this.remote).then(() => {
console.log("Celebrate");
}).catch(error => {
console.error(error)
})
}


And here is what the call to replicateLocalDBToRemote throws at me



CustomPouchError {__zone_symbol__currentTask: e, result: {…}}
result:
doc_write_failures: 0
docs_read: 0
docs_written: 0
end_time: "2018-11-21T16:23:36.974Z"
errors:
last_seq: 0
ok: false
start_time: "2018-11-21T16:23:36.874Z"
status: "aborting"


and I am afraid I can't call this a self-explanatory message.



Any guess on what might be the root cause of the issue?



EDIT: After crawling through the PouchDB repo on github, I found this entry which might refer to the same problem.







google-chrome ionic-framework couchdb pouchdb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 at 20:56

























asked Nov 21 at 16:46









Buddyshot

727527




727527












  • How many documents were in your local database?
    – IanC
    Nov 23 at 8:53










  • I would say a hundred or so
    – Buddyshot
    Nov 23 at 12:06


















  • How many documents were in your local database?
    – IanC
    Nov 23 at 8:53










  • I would say a hundred or so
    – Buddyshot
    Nov 23 at 12:06
















How many documents were in your local database?
– IanC
Nov 23 at 8:53




How many documents were in your local database?
– IanC
Nov 23 at 8:53












I would say a hundred or so
– Buddyshot
Nov 23 at 12:06




I would say a hundred or so
– Buddyshot
Nov 23 at 12:06












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










I fixed the problem by allowing traffic through port 5984 on my remote CouchDB server.



The thing is, sending requests on port 80 (i.e. GET http://<my_server>.com/mydb) does send back some data so I never bothered to try with port 5984 in the first place because I thought the API was also implemented on port 80...



So at least my issue had nothing to do with PouchDB but I wish the error message was a bit more specific.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416865%2ffail-to-replicate-a-local-indexeddb-to-a-remote-couchdb-using-pouchdb%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    I fixed the problem by allowing traffic through port 5984 on my remote CouchDB server.



    The thing is, sending requests on port 80 (i.e. GET http://<my_server>.com/mydb) does send back some data so I never bothered to try with port 5984 in the first place because I thought the API was also implemented on port 80...



    So at least my issue had nothing to do with PouchDB but I wish the error message was a bit more specific.






    share|improve this answer

























      up vote
      0
      down vote



      accepted










      I fixed the problem by allowing traffic through port 5984 on my remote CouchDB server.



      The thing is, sending requests on port 80 (i.e. GET http://<my_server>.com/mydb) does send back some data so I never bothered to try with port 5984 in the first place because I thought the API was also implemented on port 80...



      So at least my issue had nothing to do with PouchDB but I wish the error message was a bit more specific.






      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I fixed the problem by allowing traffic through port 5984 on my remote CouchDB server.



        The thing is, sending requests on port 80 (i.e. GET http://<my_server>.com/mydb) does send back some data so I never bothered to try with port 5984 in the first place because I thought the API was also implemented on port 80...



        So at least my issue had nothing to do with PouchDB but I wish the error message was a bit more specific.






        share|improve this answer












        I fixed the problem by allowing traffic through port 5984 on my remote CouchDB server.



        The thing is, sending requests on port 80 (i.e. GET http://<my_server>.com/mydb) does send back some data so I never bothered to try with port 5984 in the first place because I thought the API was also implemented on port 80...



        So at least my issue had nothing to do with PouchDB but I wish the error message was a bit more specific.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 at 22:16









        Buddyshot

        727527




        727527






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416865%2ffail-to-replicate-a-local-indexeddb-to-a-remote-couchdb-using-pouchdb%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Berounka

            Sphinx de Gizeh

            Different font size/position of beamer's navigation symbols template's content depending on regular/plain...