[Bug]: runImport
silently fails to upload if init()
is called without populating process.env.ACTUAL_DATA_DIR
#4326
Labels
bug
Something isn't working
Verified issue does not already exist?
What happened?
When trying to use
@actual-app/api
in Node.js to import data withrunImport
, the import can silently fail when finishing. Callingsync
afterward will cause additional errors (something about the metadata.json being empty). This happened both on Windows 10 and macOS for me. Tracking down the problem led me to this:actual/packages/loot-core/src/server/api.ts
Line 322 in 5f1fadb
better-sqlite3
was throwing an error here, but the error didn't include a filename so it wasn't obvious why it was throwing: https://github.com/WiseLibs/better-sqlite3/blob/ea9a0586d2daf4ec15f1fb5fcd8a618de6c1ceee/lib/methods/backup.js#L29node_modules
, I found that it was trying to backup a filename starting with'undefined/...'
. That led me to this:actual/packages/loot-core/src/platform/server/sqlite/index.electron.ts
Line 133 in 5f1fadb
init({ dataDir: '/tmp' })
instead of settingprocess.env.ACTUAL_DATA_DIR
, that env var will always be empty.Setting the env var fixed everything, but it seems like
init({ dataDir: ... })
should also be supported.How can we reproduce the issue?
Where are you hosting Actual?
Locally via Yarn
What browsers are you seeing the problem on?
No response
Operating System
Windows 10
The text was updated successfully, but these errors were encountered: