better-sqlite3
better-sqlite3 copied to clipboard
cannot fetch data in production: Electron better-sqlite3
I have an electron app based on electron-react-boilerplate
that's using an SQLite database with typeorm
and better-sqlite3
driver, everything works like charm in development mode but I'm facing an issue when I build a production bundle:
Error occurred in handler for 'login': Error: Error has occurred in =>login:user_not_found
the database file is located under app.asar.unpacked/database/database.sqlite
I'm aware that this folder missing some read/write permission.
"asarUnpack": [ "**\\*.{node,dll}", "database/database.sqlite" ], "files": [ "dist", "node_modules", "package.json", "database" ],
This looks like a duplicate of https://github.com/JoshuaWise/better-sqlite3/issues/126, unless you can reproduce this in isolation. I'd try asking on StackOverflow as well. The error message does not look like it's coming directly from better-sqlite3, so you might want to provide steps to reproduce this and an error that points to better-sqlite3.
Here is the database path from inside the production electron type, I tried to open it directly using sqlite3 command line but I faced the same Error: unable to open database file (same error in all temporary directories on other platforms: win and mac).
am I doing anything wrong? if so please help me to configure. I assume it's a read/write disk permissions