PouchDB/CouchDB Error


#1

//this.db.query(‘reports/byType’).then((data) => {

          console.log("Reports Fresh");
          console.log(data);

            let Reports = data.rows.map(row => {
               return row.value;

           });

Give me the following error:

Uncaught (in promise): {“status”:404,“name”:“not_found”,“message”:“missing”,“reason”:“missing”}

The weird thing is that if I refresh the page, it runs fine. Only on the first run does it error out.

Anyone else have this issue?


#2

Hey i am having this same problem and cannot find the solution. Did you ever find out what causes this?

Thanks,
Mike


#3

Probably your template is expecting the variable to have data too early.


#4

Yeah, if I put a set timeout in there it works, but I hate doing that. I am trying to populate my side menu from the database and the menu is bound to an array. So, when the data does not come back early enough it crashes. But, this should all be able to work using promises and/or async await.

I’m still trying to find the optimal solution.

Thanks!


#5

Fix your template so it only expects the data when it arrives, Simplest solution is probably to use the async pipe. Don’t use setTimeout. A user with slow internet will see a runtime error, but you might not in testing if your internet is fast.