If your server is bundled (Next.js, Webpack, esbuild), pass a subpath driver adapter instead of databaseType:
import { Quill } from "@quillsql/node";import { postgres } from "@quillsql/node/postgres";import { redisCache } from "@quillsql/node/redis";const quill = new Quill({ privateKey: process.env.QUILL_PRIVATE_KEY, adapter: postgres(process.env.POSTGRES_READ), // Only if you use Redis caching cache: redisCache({ host: "localhost", port: "6379" }),});
This is required when the bundle is deployed without node_modules, such as a Lambda function built with esbuild or a single-file Docker image. With databaseType, the SDK loads the driver from node_modules at runtime, so a bundler leaves it out of its output. Every request then fails with Missing optional dependency "pg", even though the driver is installed and the same code works locally. An adapter imports the driver directly, so the bundler includes it. A cache given as { cacheType: "redis", ... } loads redis the same way, so use redisCache in its place.
a subpath driver adapter, such as postgres(connectionString); replaces databaseType, databaseConnectionString and databaseConfig
databaseType
required without adapter
"postgresql", "redshift", "snowflake", "bigquery", "mysql", "clickhouse", "mssql" or "databricks"
databaseConnectionString
string; used over databaseConfig
databaseConfig
the connection as an object, by databaseType, below
cache
{ cacheType: "redis" | "rediss", host, port, username, password, ttl }, or redisCache({ ... }) with the same fields: caches results in Redis for ttl seconds, 86400 by default
Checks every tenant's alerts in the private key's environment.
Returns
status
"success" or "error"
data.alerts
{ name: string; tenantIds: string[]; report: object }[]: the alerts whose condition is met now, each with the report it is on as its tenant sees it (what query returns for the report task, with its rows)
data.errors
{ name: string; tenantIds: string[]; error: string }[]: the alerts that could not be checked
Runs dashboards' reports ahead of time, as each tenant sees them, and saves the results in the cache Redis. One run at a time per environment, across every server on that Redis, and none within 6 hours of the last one finishing.