Skip to content

Vault database role: connect fails when a new user takes a few seconds to become active #4189

Closed

Description

@AbziBzi

What happened?

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

  1. 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.
  2. Use the profile on a connection and click Test Connection.
  3. 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.

Database type

MySQL / MariaDB

Database server version

Vitess (vtgate)

TablePro version

0.87.0-beta.1 (870001)

Platform

macOS

OS version & hardware

macOS 27.0.1 / Apple Silicon

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions