Skip to content

Fix database pool configuration causing 'table not found' errors #68

@SOG-web

Description

@SOG-web

Description

When using the connection pool configuration in the database library, it causes "table not found" errors for tables that should exist. This affects both the auth system tables and regular database operations.

Error Messages

Error querying items: [Error: select * from `api_keys` - SQLITE_ERROR: no such table: api_keys] {
  errno: 1,
  code: 'SQLITE_ERROR'
}

Error: select * from `auth_config` order by `created_at` desc limit 1 - SQLITE_ERROR: no such table: auth_config

Session verification error: [Error: select * from `internal_admin_sessions` where `token` = '...' and `expires_at` > CURRENT_TIMESTAMP limit 1 - SQLITE_ERROR: no such table: internal_admin_sessions] {
  errno: 1,
  code: 'SQLITE_ERROR'
}

Steps to Reproduce

  1. Configure the database with connection pool settings:
pool: {
  min: 0,
  max: 10,
  acquireTimeoutMillis: 60000, // 60 seconds
  createTimeoutMillis: 30000,
  idleTimeoutMillis: 30000,
  reapIntervalMillis: 1000,
  createRetryIntervalMillis: 100,
}
  1. Attempt to access auth tables or perform database operations
  2. Observe "table not found" errors

Expected Behavior

The database should be able to find and access all tables regardless of the connection pool configuration.

Possible Causes

  1. Connection pool might be creating separate database connections that don't share the same schema
  2. SQLite in-memory database might not be properly shared across connections
  3. Transaction handling might be interfering with table access

Potential Solutions

  1. Modify the connection pool configuration to be compatible with SQLite
  2. Implement a shared connection strategy for SQLite in-memory databases
  3. Review and update the transaction implementation to ensure proper table access

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions