You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vault database role: connect fails when a new user takes a few seconds to become active #4189
At the company I work at, I use the "HashiCorp Vault database role" source (from #3752) for a MySQL connection that goes through Vitess. Test Source returns a username and password, but Test Connection and Connect always fail with:
[1045] Access denied for user '<leased user>' (SQLSTATE: 28000)
On that setup a newly leased user is rejected for 20 to 30 seconds before it starts working. I checked by leasing a user with the vault CLI and running select 1 every 5 seconds: it failed until about 27s, then worked. TablePro connects right after leasing, so it always fails, and each retry leases a new user, so the wait starts over.
Steps to reproduce
Create a credential profile with Read From set to "HashiCorp Vault database role", for a database where new users take a few seconds to become active.
Use the profile on a connection and click Test Connection.
It fails with 1045, and every retry fails the same way.
Expected behavior
The connection works once the leased user is active. Would it make sense to keep using a lease while it's still valid instead of leasing a new user on every sign-in? Then a second attempt would succeed, and failed attempts wouldn't leave extra users behind. A short retry on auth failure right after leasing could also help, but I'm not sure what wait time would suit other setups.
Activity