Closed
Description
I ran into this while trying to setup hypertrie
as a kappa view dataDb
. I think its related to me using the createHistoryStream
in clearIndex
https://github.com/kappa-db/kappa-view/blob/master/index.js#L34 instead of createKeyStream
from a leveldb
database. Might make more sense to use the createReadStream
instead, but it triggered this error which I think can occur in other contexts (when there's batch deletions?)
.../node_modules/hypertrie/lib/history.js:47
cb(null, node.final())
^
TypeError: Cannot read property 'final' of null
at done (.../node_modules/hypertrie/lib/history.js:47:19)
at onnode (.../node_modules/hypertrie/index.js:335:56)
at Request._callback (.../node_modules/hypercore/lib/storage.js:45:14)
at Request.callback (.../node_modules/random-access-storage/index.js:173:8)
at onread (.../node_modules/random-access-file/index.js:83:31)
at FSReqCallback.wrapper [as oncomplete] (fs.js:561:5)
Given that nodeBySeq
https://github.com/hypercore-protocol/hypertrie/blob/master/index.js#L332-L333 can return a null
value, then createHistoryStream
could also have a null
returned as a node, and can't assume that it will have a .final()
method.
PR with a fix coming up.
Metadata
Metadata
Assignees
Labels
No labels