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
fix(lakebase): getLakebaseOrmConfig() pool settings don't reach TypeORM or Sequelize #730
getLakebaseOrmConfig() returns pool settings (maxLifetimeSeconds, max, idleTimeoutMillis, connectionTimeoutMillis, statement_timeout, …) at the top level of the config object. Neither ORM it's documented for reads them from there, so TypeORM and Sequelize users don't get connection recycling (#719) or any of the other pool settings.
Recycling matters because Lakebase checks the OAuth token only when a connection opens. Access granted through Unity Catalog claims in the token stops working on a connection that stays open for hours: queries fail with 42501 permission denied while the connection stays up.
TypeORM (0.3.28)
PostgresDriver.createPool() builds the pg.Pool options from a fixed set of fields (host, user, password, database, port, ssl, connectTimeoutMS, applicationName, poolSize) and then options.extra. It never reads top-level pg-pool options, so maxLifetimeSeconds, max, idleTimeoutMillis and the timeouts are all dropped. This was already true before #719.
Sequelize (6.37.7)
Sequelize doesn't use pg-pool. It creates pg.Client instances itself and pools them with sequelize-pool, which recycles by use count (pool.maxUses) but has no age-based option. maxLifetimeSeconds has no counterpart.
Proposed fix
TypeORM: have getLakebaseOrmConfig() also return the pool settings under extra. Check with a test that Sequelize ignores the extra key, so one return shape still works for both.
Sequelize: recycle by age with pool.validate, which sequelize-pool calls on each checkout and which destroys the connection when it returns false. Record when each connection is first seen in a WeakMap and reject it once it's older than the lifetime. A custom validate replaces Sequelize's built-in check (dialects/postgres/connection-manager.js), so it must repeat that check too. Alternatively, document that Sequelize users need to handle this themselves.
Update apps/dev-playground/server/lakebase-examples/typeorm-example.ts and sequelize-example.ts, and add tests that a TypeORM DataSource and a Sequelize instance actually get the lifetime.
Activity