mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-07-15 18:12:14 -05:00
[GH-ISSUE #2835] Vaultwarden silently falls back to SQLite if DATABASE_URL is invalid #10203
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @netthier on GitHub (Oct 17, 2022).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/2835
Subject of the issue
When an invalid
DATABASE_URLis specified, e.g. with a typo such aspostgreql://user:pwd@hostor with quotes like"postgresql://user:pwd@host", Vaultwarden silently falls back to using the SQLite database without logging any errors or warnings.Deployment environment
Used image is
vaultwarden/server:1.26.0Steps to reproduce
I started vaultwarden via a docker-compose file with the
DATABASE_URLvariable setExpected behaviour
If an invalid
DATABASE_URLis specified, Vaultwarden should either log an error or a warning along the lines of "Failed to parse DATABASE_URL, falling back to SQLite"Actual behaviour
Vaultwarden starts regularly and runs migrations against an SQLite database.
@tessus commented on GitHub (Oct 17, 2022):
I've noticed the same beavior and IMO it should not fall back to sqlite, but abend with an error message.
@BlackDex commented on GitHub (Oct 17, 2022):
Where did you configured this? Docker compose file? Custom export? Systemd file. And could you give an example? Without the actual password etc if course.
@netthier commented on GitHub (Oct 17, 2022):
As mentioned in the issue, I specified this in my docker-compose file. The issue also contains examples without actual passwords.
I noticed this issue after accidentally specifying the URL like this:
Specifying it as
"DATABASE_URL=postgresql://user:pwd@host/vaultwarden"instead worked.Before opening this issue I further investigated by intentionally introducing a typo in the working variant, and removing a letter from the protocol, ending up with
postgreql://etc, which led to the same issue.@BlackDex commented on GitHub (Oct 17, 2022):
Thanks for the extra info.
The thing is that the quotes are an issue with compose, but not with export or a .env loaded by Vaultwarden it self.
But, it indeed should not continue if there is a faulty setting.
The only setting which could be seen as faulty but still should fall back is an empty string, since that indicates a default.
Thanks for the report.
@BlackDex commented on GitHub (Dec 8, 2022):
Should be resolved via #2873 already.