ionic 2 app works in browser but not on device (not a CORS issue)

54 views
Skip to first unread message

Candide Kemmler

unread,
Mar 1, 2017, 12:17:39 PM3/1/17
to PouchDB
Hi,

I started off this example:

Looking at the HTTP traffic, when I'm in the browser, I can see that there is a long sequence of queries when the app start. This sequence starts with a GET request to the root URL of my database (i.e. '/observations/') and it is immediately followed by a request to '/observations/_changes' and then '/observations/_local/somelongstringofchars'. On the device, however, I can only see the first request (i.e. '/observations/'), which proves that there are no CORS issues at hand and the device is indeed able to communicate with the server. I originally noticed the issue as I tried to do a database insert using a promise, like this:

    return new Promise((resolve, reject)=>{
     
new this.topicsDB.put(topic).then(
       
()=>{
          console
.log("OK, created topic");
          resolve
({})
       
}
     
).catch((error)=>{
        console
.log("Couldn't create topic", error);
        reject
(error)
     
});
   
});


but neither the resolve nor the reject handler was called and my call just hung. This makes me wonder what state is the app in that case and how I can avoid this sort of deadlock situation.

Thanks!

Candide


Reply all
Reply to author
Forward
0 new messages