Using Entra ID for authenticating in drizzle.config.ts
Attempting to use best practices and use the service principal in our Azure to authenticate to postgres, however i cannot do awaits inside the drizzle.config.ts so i cannot retrieve the token when running drizzle-kit push
7 Replies
i guess this is actually the issue i am facing
https://github.com/drizzle-team/drizzle-orm/issues/1982
GitHub
[FEATURE]: Support Top-level await in
drizzle.config.ts
· Issue ...Describe what you want I want to write a configuration as follows. Here, fetchDatabaseUri is a function that retrieves authentication information from AWS Secrets Manager and returns the database U...
why is it not merged :/
https://github.com/drizzle-team/drizzle-orm/pull/4075
GitHub
Add support for async configs by guillaumervls · Pull Request #407...
Description
defineConfig now accepts a promise for a config or function that returns one - fixes #1982
Testing
Added a test in drizzle-kit/tests/cli-async-config.test.ts
Depending on the 'pg' driver, the
password
property can be a async function that returns the password to use. We use this for the IAM auth in AWS, I assume you'd be able to do simillar:
e.g.
I'll try that
Doesn't seem to work with the drizzle.config.ts :/
Seems to bypass the initial check that was:
Instead, after your fix, i got this:
Just looks like the password is missing :/ as it is not receiving a string value, but an async function
Ah sorry, my bad I miss-read part of your message. We don't actually use drizzle-kit when running against our remotes (we don't really use it much at all)
Its creating the postgres connection ourselves and then passing it to a drizzle instance ...
e.g. (not the real code, but as example)
And its the postgres pool function that allows passing an async function, not at the drizzle layer
Yep, that is also what we are doing inside of the app. It's just a problem in the config. But again, it should be fixed with that pr