Problem reading leveldb store through expressjs


#1

I’m using Electron to load an ExpressJS app that uses LevelDB for session with the level-session-store package storing the data in the path.join(__dirname,'db') folder. Everything works fine when I run it locally with electron . but when I run the build I get this error

The relevant file is this but generally it’s looking for my leveldb file and that filesystem structure is not the same when the app is built or that it can’t access that folder

I’m new to desktop apps so could someone explain how I could structure this setup (or use an alternate sessioning method than leveldb) that would work in both a web server environment and Electron environment?


#2

This actually looks like an unrelated issue with the levelDB LOCK file not deleting. It runs fine if I build without --asar so I’m doing that for now. If there are is any discussion on when you want to build with --asar and when not, that would handy.


#3

The db makes files in folders not inside asar/zips. Hence, you are getting the not a directory message. I have not looked into this yet, but if you can have the database be created OUTSIDE the asar package, then you should have no problem.

P.S: Currently, I am using PouchDB with memdown (in memory db adapter)


#4

Thanks. When I build without asar (I’m using https://github.com/maxogden/electron-packager) it works and I’m able to get persistent sessioning. Where would it be saving the db info if it didn’t have access to asar zip? This is related to a more general question of where to store config files that I would normally put in the project root.