kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
482 stars 39 forks source link

v2.3.2 TypeError: Cannot read property 'dbi' of undefined #159

Closed meischke closed 2 years ago

meischke commented 2 years ago

My app works fine with lmdb v2.2.6 The error appears after updating lmdb

test.js

const lmdb = require('lmdb')

const dbstore = lmdb.open({
  path: './Database/',
  dupSort: true
})

console

$ node test
/test/node_modules/lmdb/dist/index.cjs:2108
                        if (this.db.dbi == 0xffffffff) {// not found
                                    ^

TypeError: Cannot read property 'dbi' of undefined
    at new LMDBStore (/test/node_modules/lmdb/dist/index.cjs:2108:16)
    at Object.open (/test/node_modules/lmdb/dist/index.cjs:2286:35)
    at Object.<anonymous> (/test/test.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47
kriszyp commented 2 years ago

I can't reproduce this. Do you have any more information on platform, node version, or any other code required to reproduce this?

meischke commented 2 years ago

node 14.19.1 Linux Mint 20.3 Kernel: 5.15.26

kriszyp commented 2 years ago

Hmm, I'm testing with almost identical set up, but no errors. However, I can reproduce this if I include dupSort flag. I just committed a fix for that. Do you want to try that? (or do you need a (NPM) published version?)

meischke commented 2 years ago

Thanks, i use dupSort oh, i forgot dupSort:true option in my post

kriszyp commented 2 years ago

Ah, ok, that's certainly the issue then. I went ahead and published this fix in v2.3.3.