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

PouchDB 7.0.0 - TypeError: Cannot ready property 'id' of null #95

Open
aneer-anwar opened this issue Apr 4, 2019 · 7 comments
Open

Comments

@aneer-anwar
Copy link

aneer-anwar commented Apr 4, 2019

Android : 7.1.4
IOS : 4.5.5

I tried PouchDB 7.0.0 and 6.4.0 with pouchdb-adapter-cordova-sqlite 2.05 and 2.0.2
with Cordova-sqlite-storage,cordova-plugin-sqlite-2 and cordova-plugin-websql.
cacheableLayers = {
"A" : "aaaaa",
"B" : "bbbb"

}
for (let key in cacheableLayers) {

        ddoc.views[key] = {
            map: "function (doc) { "
                + "if (doc['" + key + "'] ){"
                + "emit('" + key + "',doc['" + key + "']);"
                + "}"
                + "}"
        }
    }

db.put(ddoc).then()...
When I try to put view into pouchdb I get the error: 'TypeError: Cannot read property 'id' of null' in android. Fortunately, the same code works correctly in IOS without any glitch.

Please help.
IMG-20190404-WA0002

@TDola
Copy link

TDola commented Nov 5, 2019

I am having the same error on 1 device now when conflicts are found

@TDola
Copy link

TDola commented Nov 6, 2019

I have traced it to this line 1417 in pouchdb-adapter-websql-core -> index.es.js
image
metadata appears to be null.

Probably means bad json data stored in the database somewhere

@efratyo
Copy link

efratyo commented Jan 29, 2021

@TDola Was that eventually a bad json data issue? Were you able to trace down the specific bad doc?
I'm having the same problem, guessing it's a corrupted doc that causing it.

@TDola
Copy link

TDola commented Jan 29, 2021

@TDola Was that eventually a bad json data issue? Were you able to trace down the specific bad doc?
I'm having the same problem, guessing it's a corrupted doc that causing it.

I never figured it out. Instead I built into the application a reset the user could trigger that would delete the databases and could be triggered automatically by odd data. In my application all the data is on a couch server and pouchdb is an offline store. So losing it isn't a big deal because it re-replicates when the user is back online.

@efratyo
Copy link

efratyo commented Jan 29, 2021

@TDola Interesting. Sadly for me that's not my case, we can't afford losing the pouchdb.
How did you catch the odd data to trigger this reset?

@TDola
Copy link

TDola commented Jan 29, 2021

@TDola Interesting. Sadly for me that's not my case, we can't afford losing the pouchdb.
How did you catch the odd data to trigger this reset?

A simple date that gets updated. If the date is ever too old, suggesting something like a database backup happened, then it resets and starts again. This is a phone specific solution though because I used the phone database. Sorry I can't help more than that 🤔

@efratyo
Copy link

efratyo commented Feb 2, 2021

@TDola Yes, this won't work in my case. Thanks for the quick replies!

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

3 participants