Hello all! New to the forums, so forgive me if this is not the right place/format.
What I’m trying to do
Use Obsidian Headless CLI to log in and download from a remote vault. This is being done on Netlify as part of a pre-build command.
What I did
#!/bin/bash
ob login --email $OBSIDIAN_EMAIL --password $OBSIDIAN_PASSWORD &
wait $!
ob sync-setup --vault myvault --path myvault --password $VAULT_PASSWORD
ob sync-config --path myvault --mode mirror-remote --device-name site-auto
ob sync --path myvault
What happened
12:56:25 AM: Logged in as (****)
12:56:25 AM: Fetching vault info...
12:56:25 AM: Setup failed: s [Error]: Not logged in
12:56:25 AM: at X (/opt/build/repo/node_modules/obsidian-headless/cli.js:141:715)
12:56:25 AM: at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
12:56:25 AM: at async Command.<anonymous> (/opt/build/repo/node_modules/obsidian-headless/cli.js:150:802) {
12:56:25 AM: response: { error: 'Not logged in' },
12:56:25 AM: error: 'Not logged in'
12:56:25 AM: }
Things I have tried
- Running the commands locally (successful)
- Checking the environment variables, making sure they’re passed correctly
- Replacing
wait $!withsleeps - Running
login && sync-setupon the same line
Any help at all would be greatly appreciated! I feel like I’m losing my mind here :’)