npm / pg-boss
pg-boss
What changed in pg-boss 10 to 12, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.
128 breaking3 deprecations137 new APIs and options5 performance42 behavior and defaults4 tooling96 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initpg-boss 12322 changes
Breaking changes 63
Hour-restricted cron schedules with a timezone now send once at repeated local times when clocks go back; schedules naming every hour still send in both repeated hours, and missed: 'once' follows the same rule.
Deletes in batches and resolves to the number of jobs deleted; failures can leave a partial delete.
Returns matching jobs oldest first and at most 1,000 by default; callers can use limit and after to read further pages.
Reads at most limit jobs of each kind, defaulting to 1,000 and allowing up to 100,000; total is no longer exact and counts only jobs read.
After upgrading, totalCount retains its prior count until the queue's first maintenance pass, then may temporarily be off after concurrent deletes or resumes during counting.
A job naming a missing dead-letter queue now rejects with Dead letter queue <name> does not exist.
Deleting a partitioned queue no longer waits indefinitely on concurrent sends; it retries lock acquisition for about 3 seconds, then rejects and leaves the queue unchanged.
Flow creation now rejects when a queue was deleted by another instance.
Inserting into a queue deleted by another instance now rejects with Queue <name> does not exist instead of reporting nothing done.
Previously stored schedules with empty expressions are skipped by the cron pass with an invalid_schedule warning instead of firing every minute.
schedule() rejects empty, blank, or non-string cron expressions; previously an empty expression could be read as every minute.
schedule() writes on a passed db, and no longer stores db with the schedule.
Sending to a queue deleted by another instance now rejects with Queue <name> does not exist instead of resolving null; in a passed transaction, COMMIT can fail with 23503.
stop() settles in-flight claims before completing; a claim not ready within the timeout is failed without starting its handler, so shutdown can exceed timeout. With graceful: false the job is failed at once.
Upserting into a queue deleted by another instance now rejects with Queue <name> does not exist instead of resolving null or reporting nothing done.
Jobs waiting on a flow parent are no longer included in readyCount because no worker can fetch them.
resume() moves a job's startAfter up to the time of the call, so wait counting starts when the job can run again.
retry() moves a job's startAfter up to the time of the call, so wait counting starts when the job can run again.
On CockroachDB, failing a batch containing an already completed or cancelled job no longer deletes that job.
A destination collision no longer deletes the dead-lettered job: it remains failed with a reason in output, and is not counted as re-created.
Job now declares retryCount, moved from JobWithMetadata; code that constructs Job objects by hand needs to provide it.
On queues with heartbeatSeconds, the handler's signal is aborted when a heartbeat finds the job is no longer active under that worker's claim.
tick() waits for pg-boss statements in flight before starting, after each fired timer, and at the target time; tick() or setTime() rejects while either is in progress.
On CockroachDB, fetch() now returns integer fields, including sourceRetryCount, as numbers.
On CockroachDB, findJobs() now returns integer fields, including sourceRetryCount, as numbers.
On CockroachDB, getJobById() now returns integer fields, including sourceRetryCount, as numbers.
When redriven jobs collide under a destination's short policy, PostgreSQL now keeps the older one; on CockroachDB either one may be kept.
When redriven jobs collide under a destination's singleton policy, PostgreSQL now keeps the older one; on CockroachDB either one may be kept.
Forward time jumps fire overdue timers once on the next tick and reset interval periods from the new time; backward jumps leave pending timers alone, and calls during a tick now throw.
CockroachDB refuses transactional workers on queues with heartbeatSeconds; a heartbeat arriving after registration fails the batch before its transaction opens.
Registration rejects perJobResults when transactional is enabled because a transaction has a single outcome.
Transactional workers run the handler and job completion in one transaction. The handler receives the transaction db as a second argument; a thrown error rolls back both handler writes and completion.
Reads the schedule row for a name and key, returning null when none exists; the key defaults to the empty string.
Schedules without a time zone are backfilled to UTC, and the column now defaults to UTC instead of evaluating in the instance's local zone.
The
orderByCreatedOnfetch option is deprecated and ignored; jobs are always fetched in priority and creation order.Reports indexes not owned by the connected role before attempting them and sets a non-zero exit code.
Index rebuilding is on by default during maintenance; set reindex: false to keep detection and warnings without rebuilding.
publish() rejects with an AggregateError when sends to subscribed queues fail, identifying each source queue.
partitionTables now takes records with tableName and policy instead of strings, allowing migration scripts to target partitions according to queue policy.
schedule() now rejects an unusable time zone up front instead of storing a schedule with a bad timezone.
Strings beginning with an ISO 8601 calendar date are now treated as date times in send-related operations and update()/upsert(); zone-less date times are pinned to UTC.
An empty schema value is rejected instead of passing validation and producing unparseable DDL.
start() refuses to install into a schema when a case variant already contains a pg-boss installation, preventing jobs from appearing to vanish into a different schema.
DELETE and cache-eviction errors now reject; deleting a nonexistent queue remains a no-op.
Only unique-constraint violations are treated as an empty fetch; other database errors propagate, and direct fetch() calls reject.
Passing the same explicit job id twice in one batch now throws instead of silently deduplicating.
Migration from a database version below the oldest supported starting version now fails with a clear message instead of applying migrations over missing steps.
The obsolete keepUntil insertion-time type is dropped.
Flow processing moved from job completion CTEs to an async worker for performance; the worker is gated behind the supervise option.
Jobs are aborted when the graceful shutdown period expires.
The overloads were simplified to offWork(name, options).
Removes the exported policies constant from the package.
Removes the unused QueuePolicies type from the package's exports.
The default export was removed; switch require() or import to use the PgBoss named export.
Static functions and constants previously accessed on the PgBoss class are now named exports.
Static functions and constants previously accessed on the PgBoss class are now named exports.
Static functions and constants previously accessed on the PgBoss class are now named exports.
The minimum Node.js version was increased to support require(esm).
Use the named PgBoss export instead of the default export when requiring or importing the package.
Static functions and constants previously accessed on the PgBoss class are now named exports.
Queue names now only support letters, numbers, hyphens, underscores, or periods; review existing names before upgrading.
Scheduling keys now only support letters, numbers, hyphens, underscores, or periods; review existing names before upgrading.
Static functions and constants previously accessed on the PgBoss class are now named exports.
Deprecations 3
The singletonsActive field on getQueue() and getQueues() is deprecated and will be removed in the next major.
backend: 'yugabytedb' still works but emits a Node DeprecationWarning with code PGBOSS_DEP_YUGABYTEDB and will be rejected in the next major.
The
priorityfetch option is deprecated and ignored; jobs are always fetched in priority and creation order. Its use emits a Node DeprecationWarning.
New APIs and options 117
Returns at most 1,000 rows by default in version and creation order; supports limit and after paging.
Returns at most 1,000 rows by default in key order; supports limit and after paging.
Returns at most 1,000 rows by default, ordered by queue name and id; supports limit and after paging.
Returns at most 1,000 rows by default, oldest first; supports limit and after paging.
Returns at most 1,000 rows by default in name order; supports limit and after paging through its options argument.
Returns at most 1,000 rows by default, ordered by queue name and key; supports limit and after paging.
An options type for bounded list reads is now exported.
The options type for previewRedrive is now exported.
getUninstallPlans(schema, { backend }) returns SQL to remove pg-boss objects from a shared schema without CASCADE.
The uninstall command prints SQL to remove pg-boss objects from a shared schema without CASCADE.
Pass attempts to retry start after database failures, waiting 1 second between tries and doubling up to 30 seconds; configuration AssertionErrors are not retried.
getQueue() and getQueues() report jobs waiting on a flow parent as blockedCount.
Lists pg-boss instances registered in the database with runtime information.
Schema 44 adds an instance table, and each PgBoss object now keeps a row there with runtime information.
A new constructor property lets you change the default 30-second instance heartbeat.
A new constructor property lets you name the registered instance.
pg-boss creates messaging-semantic-convention spans and metrics through @opentelemetry/api; without a registered SDK they are no-ops.
The constructor option can disable OpenTelemetry instrumentation with enabled: false.
The OpenTelemetry constructor option accepts a meter provider.
Opt-in trace propagation stores trace context on jobs so workers continue the producer's trace across retries, dead lettering and redrive.
The OpenTelemetry constructor option accepts a propagator.
The OpenTelemetry constructor option accepts a tracer provider.
getQueueStats() accepts percentiles and returns wait and run time percentile values for each snapshot.
Queue snapshots report how long the oldest ready job had waited at the monitor pass.
Short-lived processes such as serverless functions should set registerInstance: false to avoid each invocation reading as a crash when stop() is not used.
Counted monitor passes expose a 48-bin histogram of job run times.
Schema 44 adds a job column for stored trace context used by opt-in trace propagation.
Counted monitor passes expose a 48-bin histogram of how long finished jobs waited before a worker started them.
Accepts a fetched job or an { id, retryCount } object to settle only the attempt that was fetched; a plain id still applies to the current attempt.
Queue stats snapshots include the number of jobs completed since the previous monitor pass when persistQueueStats is enabled.
Queue stats snapshots include the number of jobs created since the previous monitor pass when persistQueueStats is enabled.
Accepts a fetched job or an { id, retryCount } object to apply only to the attempt that was fetched; a plain id still applies to the current attempt.
Queue stats snapshots include the end time of the throughput interval, which is 10 seconds before capturedOn.
Queue stats snapshots include the number of seconds covered by the throughput counters.
Queue stats snapshots include terminal failures since the previous monitor pass; jobs that will be retried are not counted.
Reports whether a cron pass is in flight.
Dead-lettered jobs expose the failed original's output as sourceOutput; their own output starts empty.
Links every dead-letter and redrive hop to the original job id, enabling lineage lookup after intermediate failed jobs are deleted.
Previews a redrive without moving jobs, returning the total, destinations, and unroutable count; it accepts the same options as redrive() except limit.
redrive() can filter jobs by when they arrived in the dead letter queue; a shared cutoff can keep jobs arriving during repeated calls out of the sweep.
redrive() can filter dead-letter jobs by payload, matched the same way as findJobs().
redrive() can be restricted to specified job ids in the dead letter queue.
Schema 42 creates a function through which pg-boss statements read the clock, enabling TestClock to control database time.
The --fix option repairs a leftover TestClock override on job_now() and reruns the scan; only use it when no live TestClock is held against the schema.
Pass a TestClock using the new clock constructor option to control queue timing in tests.
TestClock lets tests advance JavaScript dates, PostgreSQL timestamps, and worker polling together without waiting for real time.
IDatabase gains an optional method returning a transaction handle with db, commit(), and rollback(). Custom db adapters can implement it to enable transactional workers.
A warning event reports when the server cannot identify its transaction timeout parameter and handlers run without a database-side bound.
A warning event reports when a transactional worker is registered on a pool with no connections to spare.
Sets the database-side limit for a handler's transaction. It defaults to expireInSeconds plus five seconds, and 0 removes the limit.
A config-file backend profile selects the engine-specific behavior for CLI commands.
Adapts Bun's SQL client for use as the pg-boss db option, letting a Bun application share one client and pool.
Accepts a backend profile in its options and can now also receive createSchema: false.
The newly accepted options object exposes createSchema: false for schemas that already exist or are created elsewhere.
Accepts a backend profile in its options so generated migration SQL matches the selected engine.
Accepts a backend profile in its options so generated rollback SQL matches the selected engine.
Schedule rows carry the ID of the most recent job they produced, allowing a schedule to be joined to that run without maintaining a separate record.
A compatibility flag identifies engines that refuse to write a column in the transaction that added it; CockroachDB sets it.
The CLI accepts a backend profile so schema commands emit SQL accepted by the selected engine.
Selects the backend profile for CLI commands when set in the environment.
Purely computes upcoming cron or recurrence-rule occurrences as Date values without a query or started instance; count defaults to 5 and is capped at 1000.
Exports the maximum previewSchedule count so services can validate requests against the same ceiling.
The new missed option selects whether a schedule skips missed occurrences or sends one job for the most recent missed occurrence.
Schema 41 adds a constrained schedule.kind column to record whether a schedule expression is cron or a recurrence rule.
Adds an option to disable vacuum monitoring; it defaults to on and can be set to false to turn monitoring off.
Adds a connection-free entry point that returns SQL plans for index bloat.
Adds an instance method that returns statements for manually rebuilding job indexes, skipping ownership and size filters.
Adds an informational INDEX BLOAT section that does not change the command's exit code.
Adds a CLI command to rebuild bloated job indexes.
Prints the SQL instead of rebuilding indexes.
Rebuilds every job index rather than only bloated ones.
Sets the live entries per page below which an index counts as bloated; the default is 5.
Sets the largest index size eligible for rebuilding; the default is 2 GB.
Sets the minimum number of 8 kB pages for an index to be checked; the default is 128.
Sets how many times larger than its estimated live-entry size an index must be to count as bloated; the default is 4.
Sets how often the index bloat check runs; the default is 1 day.
Accepts a second options argument to skip index work or force rebuilding every job index immediately.
The MigrationPartition type is now exported for callers using the new partitionTables record shape.
Set this option to true to allow installation when another pg-boss installation exists in a schema whose name differs only by case.
Adds a constructor option to tune the interval between listener heartbeat checks. Default 10000.
Adds a constructor option to tune the per-heartbeat query timeout; the listener reconnects if a heartbeat exceeds it. Default 5000.
Adds a constructor option to tune the TCP keepalive initial delay on the listener connection. Default 10000.
Adds a read-only comparison of the live database against pg-boss's expected schema, returning a structured SchemaDriftReport.
Updates the payload and/or options of not-yet-active jobs, targeted by id or singletonKey; supports matching shared keys and returns jobs and an updated count.
Updates matching jobs first and inserts if none match, using the same targeting and match semantics as update().
The dashboard supports dynamic views on the jobs page.
Adds persistQueueStats; the release notes do not specify its behavior or configuration details.
Adds DLQ redrive functionality.
Added a constructor option to configure the flow worker polling interval; it is gated behind the current supervise option.
Added an API to manually do what the flow worker does.
Adds LISTEN/NOTIFY support.
Adds burst mode options for work(), including burstWhenBatchFull.
Adds burst mode options for work(), including burstWhenReadyExceeds.
Batch handlers can settle jobs individually through perJobResults.
Job dependencies can now be defined using flow().
wip is exposed for developers to use.
Transaction adapters are implemented for popular ORMs and SQL builders.
Adds maxPriority as a jobFetch option.
Adds minPriority as a jobFetch option.
Heartbeat functionality is implemented.
Adds a job dashboard for viewing pg-boss jobs.
A new queue policy, key_strict_fifo, is available.
Queued jobs can now be marked complete using complete.
Job fetch can disable created_on sorting.
Jobs can be configured to never be removed.
Adds concurrency configuration and concurrency support.
Adds findJobs.
Exports the QueueOptions type from index so developers can import it from the package entry point.
The InsertOptions type is now exported for developers to use in their code.
Built-in spies are available for improved testability.
An overload lets you delete all jobs from all queues.
A Job is passed with an AbortSignal that aborts when expireInSeconds elapses.
WorkHandler now has a generic return type, allowing developers to specify the type returned by a work handler.
Added the database option and set its default to 10s.
Added the wait option to opt into waiting until the worker finishes all jobs.
Schema creation can now be optionally disabled, allowing developers to control whether pg-boss creates its schema.
A new export provides the expected events you can listen to.
Performance 5
Expired jobs and orphaned dependencies are deleted a queue at a time, with each batch in its own transaction, limiting long-held locks and xmin horizons.
Fetch now walks an index ordered by priority and creation time instead of sorting eligible rows, substantially reducing query time and buffers at the cost of a larger index.
The index was tuned to remove the INCLUDE (covering) clause because it was no longer in use; review the schema migration and plan for reindexing on very large queue tables.
Performance improvements may make pg-boss run faster.
Simplified offWork to remove polling.
Behavior and default changes 37
If registration has not succeeded, a heartbeat now tries to register the instance again; that registration also counts crash restarts.
Once a pending background command is found, pending commands run back to back; commands from one migration on one table run in order and wait for predecessors to complete.
Deletes in batches and resolves to the number of jobs deleted, or null when TRUNCATE is used; failures can leave a partial delete.
On a shared table, deletes jobs in batches before deleting the queue; a failure can leave jobs partially deleted and the queue in place.
Returns one row per status, ordered by status, without a limit.
When enabled, handler_overrun, a failed LISTEN/NOTIFY listener, and a disabled xmin_horizon check are written to the warning table.
Runs pending background migration commands after the migration commits; on failure, exits with an error listing statements left to run by hand.
Without table partitioning, old snapshots are deleted in batches on every supervise pass; with partitioning, whole days are still dropped.
The timeout now bounds how long stop waits for a running background migration command; graceful: false ends the command at once.
Expired jobs are failed in batches, so recovery after a fleet outage uses short transactions.
If a handler outlives its timeout, its worker waits for it to return before fetching again and emits a handler_overrun warning; a handler that never returns holds the worker until stopped.
unschedule() now runs its write on a passed db.
When not set explicitly, connections on a pool created by pg-boss are named pgboss: plus the first 8 characters of the instance id instead of pgboss.
No longer takes at least 500 ms after a worker has done work; waits on worker cleanups within the same deadline instead of polling.
Accepts a fetched job or an { id, retryCount } object to settle only the attempt that was fetched; a plain id still applies to the current attempt.
For dead-letter queues using this policy, only the oldest collision per singletonKey is failed; later jobs remain queued until the key is resolved.
Accepts a fetched job or an { id, retryCount } object to apply only to the attempt that was fetched; a plain id still applies to the current attempt.
On CockroachDB, schema drift detection now reports missing and invalid indexes and functions without comparing their definitions.
The queue backlog warning now includes the queue name and size, making it easier to identify the affected queue.
Each timer schedules its next attempt from when its claim stamped the row, preventing short gaps between passes while still refusing claims before the full interval.
schedule() accepts RFC 5545 recurrence rules and calendar recurrence lines as well as cron expressions, and stores the expression format in the schedule row.
On Bun 1.4.0 and later, pg-boss uses the client's listen support for LISTEN/NOTIFY delivery; older runtimes fall back to polling.
Adds a maintenance warning when no vacuum is running on the table.
A warning is emitted when queue monitoring backs off to give autovacuum a clean window.
Monitoring backs off when scanning takes more than a tenth of
autovacuum_naptime, allowing an autovacuum worker a clean window.Vacuum monitoring is enabled by default and can warn when vacuum is unable to reclaim rows or is disabled.
Adds a maintenance warning when vacuum runs but reclaims nothing, identifying the holder of the pinned horizon and relevant connection details where readable.
Schema drift detection now compares INCLUDE payloads and reports mismatches in differs; comparison is order-insensitive.
Passing null to updateQueue() now clears heartbeatSeconds; omitted options remain unchanged.
Passing null to updateQueue() now clears retryDelayMax; omitted options remain unchanged.
Upgrading runs a migration that adds an index; on partitioned installations BAM builds it concurrently in the background, and getBamStatus() reports progress.
The schema value may be pre-quoted to use PostgreSQL identifiers that are not legal bare names or to preserve mixed case. Quoted and unquoted spellings can refer to different schemas.
Distributed database support was improved.
workId is added to localConcurrency workers and WIP data.
Queue and event names can now contain forward slashes.
Makes migrations asynchronous.
The work method now has a generic return type.
Tooling 4
This package is a new peer dependency, at version range ^1.9.0.
Adds a CLI command that scans for schema drift, prints remediation DDL, and exits with code 1 on drift or 0 when clean.
The CLI supports asynchronous migration exports.
pg-boss adds CLI support.
Fixes and other changes 93
Emitted declarations now include the jobs, requested, affected and settled fields, allowing code that reads affected from complete() to compile.
The data parameter now accepts unknown, so a caught error can be passed to fail() under strict TypeScript settings.
With { db }, subscription lookup now uses the supplied database instead of pg-boss's own pool, avoiding an extra connection and allowing publish after stop().
A failed job with retries left now has its deletion time moved forward along with its retry time, so it is not deleted before the retry runs.
Deletion time is now exactly the retention window after a job's new start time, including when that time moves across a daylight saving change.
Concurrent fetches now recount group activity after claims commit and return over-limit jobs to created before handlers see them; a fetch that returns its whole batch retries up to three times.
Published declarations now include ResolvedConstructorOptions and CompatibilityFlags, fixing TS2724 when projects typecheck dependencies with skipLibCheck: false.
Pool connection setup now runs in pg-pool's onConnect before checkout; setup failures fail checkout and close the connection instead of handing it out unconfigured.
Workers now time polling rounds with the system clock, so setting a configured TestClock back during a round no longer delays the next poll; job timestamps still use the configured clock.
A custom adapter's executeSql must return an array with one result per statement for multi-statement queries; returning only the last result breaks maintenance passes and background migration claims.
Expiry no longer deletes jobs from another queue when jobs share an id on the shared job table.
The old index now remains in place until its replacement has been built, preventing slow fetches after a failed background index build.
Multi-statement query results over postgres-js are flattened, allowing pg-boss to find rows from statements before the last.
Redriving from a dead letter queue on the shared job table now touches only that queue's jobs, avoiding deletion or in-place failure of another queue's job with the same id.
Fetches from singleton and stately queues now check whether a key has an active job instead of relying on the cached list, preventing completed-job keys from staying blocked.
A pass that loses the lock now lets the next pass count its queues, keeping counts within about one interval for getQueue(), getQueueStats(), the dashboard, queue_stats history, and large-queue warnings.
Using pg-boss before start() now reports that start() must be called, rather than naming the internal open().
publish() skips a subscribed queue deleted while it is running, unless the send ran on a passed db.
Concurrent upserts with the same singletonKey now agree on one job instead of inserting duplicates; on CockroachDB, a later upsert may fail with 40001 and is retried up to 3 times when pg-boss owns the transaction.
When truncating without a name or truncating a partitioned queue, zeroes cached queue counts so getQueue() reflects the deletion immediately.
On CockroachDB, jobs with array data can now fail without a JSON syntax error leaving them active.
Fixes JSON payloads being encoded twice by Bun SQL, restoring data-filter matching, schedule updates, and persisted warning data.
The JobAttempt type is now exported for code passing { id, retryCount } to the settle methods.
On CockroachDB, readyCount and failedCount are now returned as numbers.
On CockroachDB, calls using bucketSeconds or maxDataPoints no longer throw.
Runs one pass at a time with the background supervisor; stop() waits for an in-flight call, and calls after stop resolve without running.
redrive() now works on CockroachDB, running the move as three statements in one transaction with the same filters, order, and limit.
Failed dead-letter jobs now retain their source queue metadata when reinserted, allowing redrive() to route them back; jobs that already lost the fields are not repaired.
update() no longer fails on CockroachDB because it no longer uses the unsupported jsonb_exists() function.
updateQueue() no longer fails on CockroachDB because it no longer uses the unsupported jsonb_exists() function.
Scheduled jobs are filed under the minute their occurrence falls in, preventing duplicate, dropped, or lost occurrences and aligning schedule kinds.
A cron pass at an exact whole-minute database clock reading now finds occurrences due at that minute instead of sending them one pass late.
A global pg-types parser returning a value other than a Date no longer breaks pg-boss when it shares the application's connection pool.
Cron workers no longer miss sending scheduled jobs when multiple instances run and cronMonitorIntervalSeconds is set above the default of 30s.
Completes a re-attempt whose index is already valid.
offWork waits for workers that are already stopping, affecting worker shutdown behavior.
A tick now produces a pass; tests that tick twice to get one pass should tick once per expected pass.
A stop after stop({ close: false }) now closes the connection pool.
Array parameters are expanded for drivers that cannot encode JavaScript arrays, also repairing completion paths under fromDrizzle() on bun-sql.
Bun is a supported runtime; pg-boss can use Bun's client through an adapter or the bundled pg driver.
JSON parameters are cast through ::text for drivers that infer statement parameter types and would otherwise reject JSON arguments.
The occurrence key format changes to avoid collisions between distinct queue-name and schedule-key pairs that previously could cause a schedule to lose jobs.
The cron pass evaluates schedules independently, skipping an unevaluable row and emitting one invalid_schedule warning for each broken schedule rather than stopping all scheduling.
Passing null to updateQueue() now clears deadLetter instead of writing the literal string 'null'.
expireInSeconds now accepts exactly 86,400 seconds.
Fetch now picks one eligible FIFO head per singletonKey before applying priority and the batch limit, so a blocked key no longer prevents unrelated keys from being delivered.
Redriven jobs now receive dead_letter from the destination queue and its expiration and heartbeat config, while preserving priority, singletonKey and group.
Catalog comparisons now resolve the configured schema to its stored PostgreSQL name, fixing partition maintenance, schema drift detection, and BAM background index probes for mixed-case bare schema names.
The 50-character limit is now measured in bytes, preventing quoted multibyte names from being truncated by PostgreSQL and diverging from the configured name.
For names that are illegal as bare identifiers, the validation error now includes the quoted schema configuration to use; when quoting would not help, it identifies the blocking rule.
Fixes insert() so group id and tier are persisted.
Fixes the ready sparkline overflowing the dashboard stat card.
Fixes a crash with the postgres.js driver by treating arrays whose elements have no
rowsproperty as the row set itself.Fixes a query plan regression that could make job fetching slow and pin database CPU when a saturated group had a large pending backlog.
The listener detects dead connections and lost subscriptions, reconnects with capped backoff, re-runs LISTEN, and fires the reconnect hook so workers drain missed jobs.
fetch() now includes jobs whose start_after equals now(), so a job inserted with the default start_after is not skipped until the clock ticks.
The adapter now escapes literal jsonb question-mark operators before binding, fixing Undefined binding(s) detected errors in affected queries.
The listener only self-heals after connecting at least once, so an initial connection failure falls back to polling without an untracked reconnect.
When retryBackoff is true and retryDelay is unset, the backoff path now floors the delay to 1 second instead of retrying immediately.
Honors startAfter values of 0 and below, allowing a deferred job to be pulled forward to now.
Fetch errors in a work() loop are routed to the worker's error handler and emitted as an error event.
Warning thresholds are scoped to each instance instead of being shared across instances.
Fixes the public type for spies.
Fixes deadlocks during migrations. Upgrades from 12.20 or earlier should skip incremental upgrades and use this version.
Evicts the queue metadata cache on create, update, and delete.
Fixed an issue with the Drizzle adapter.
All schedules can now be queried.
The release includes changes related to alternative databases.
Startup state is reset after start errors, preventing a failed start from leaving stale state.
Missing public input and option types are now exported for developers to use.
Fixes results being returned as an array of objects instead of a single object.
WIP now emits reliably, including during slow jobs.
Public constructor types no longer have an implicit dependency on @types/pg.
Addresses a database placeholder issue.
Tier capacity is no longer silently ignored when using localGroupConcurrency with tiers.
Its typing now matches pg.PoolConfig, improving compatibility when configuring database options.
Fixes a head-of-line blocking bug in groupConcurrency.
Boss.stop() now waits for pending maintenance, Bam, and Timekeeper work to complete before returning.
The release notes list Proxy as a change but provide no further details.
The deadletter property can be passed as an option when creating a job.
The types.InsertOptions type was updated; the notes do not specify what changed.
The PgBoss constructor option is now publicly visible in TypeScript, allowing developers to use it with the public types.
IDs can be returned when spies are disabled.
Fixes how retry delays are calculated.
Queue stats are now calculated properly when a queue has no jobs.
Calling createQueue no longer mutates the supplied arguments by assigning policy the default value standard when it is missing.
Calling fetch no longer mutates the supplied arguments by assigning batchSize the default value of 1 when it is missing.
Calling work no longer mutates the supplied arguments by assigning batchSize the default value of 1 when it is missing.
Updated package bundling to resolve issues with the Bun runtime and external ESM dependencies such as serialize-error.
Bundled serialize-error so CommonJS projects can work in edge cases.
stop() now waits long enough for all resources and timers to be cleaned up.
Exports the SendOptions type so developers can use it from the package.
A few stray types were fixed.
pg-boss 1149 changes
Breaking changes 34
updateQueue() now throws if policy or partition is passed; their types are updated to match. Create a new queue to change these settings.
The archive() API has been removed.
Archive tables have been removed; completed jobs remain in the job table until they are removed.
This configuration option has been removed.
This configuration option has been removed.
Automatic migration from v10 or lower is not supported because of significant job partitioning changes; move jobs manually via the API or SQL.
Removed with no replacement; see deleteAllJobs(name).
Removed in favor of clockMonitorIntervalSeconds.
Queues no longer automatically get a dedicated table; set partition to true to opt into a dedicated table, intended for high-volume queues.
Removed; use deleteAfterSeconds on a queue or job instead.
Removed; use deleteAfterSeconds on a queue or job instead.
Removed; use deleteAfterSeconds on a queue or job instead.
The constructor-level setting was removed; configure deleteAfterSeconds on a queue or job instead.
Removed in favor of supervise().
The insert() job property was renamed to expireInSeconds, which takes a number.
Replaces the insert() job property expireIn and takes a number.
The includeArchive option has been removed.
getQueueSize(name) has been removed; use getQueueStats(name) for immediate stats that bypass the queue stats cache.
Added to retrieve immediate queue stats while bypassing the queue stats cache.
insert(PgBoss.JobInsert[]) now requires the queue name as its first argument.
The event has been removed.
Removed in favor of maintenanceIntervalSeconds.
Its meaning changed to maintenance, which removes completed jobs according to deleteAfterSeconds and queued jobs whose retention policy expired; it now defaults to 1 day.
The event has been removed; queue monitoring and metrics are now stored in the queue table.
This configuration property has been removed.
Node 22 is now the minimum required version.
Removed with no replacement; see deleteQueuedJobs(name).
Removed in favor of deleteQueuedJobs(name).
Removed for queues and jobs in favor of retentionSeconds.
Removed for queues and jobs in favor of retentionSeconds.
Removed for queues and jobs in favor of retentionSeconds.
Added to limit the growth of exponential backoffs during job retries.
Removed in favor of singletonSeconds.
Removed in favor of singletonSeconds.
New APIs and options 11
The new exclusive queue policy allows only one job to be queued or active.
Queues can override warningQueueSize; the default 0 inherits the constructor value.
Added as an example of a queue-table monitoring and metrics property.
Added to createQueue() and send() to control how long completed jobs remain before removal; the default is 7 days.
Added an optional key argument to retrieve schedules by key.
Added to support multiple schedules per queue, with one schedule per unique key.
Added to control how often queues are monitored; defaults to 60 seconds.
Added an optional key argument to make schedules keyed by unique key easier to use.
Added an event that can notify when a queue backlog grows too large or a query takes too long.
Added as a constructor setting to tune queue backlog warnings; defaults to 10,000.
Added as a constructor setting to tune slow-query warnings; defaults to 30 seconds.
Behavior and default changes 2
The default is 7 days; large-volume queues may need a shorter duration.
Queue monitoring and metrics are now stored in the queue table and can normally be retrieved via getQueues().
Fixes and other changes 2
During supervise, unwraps SQL results when they are returned as an array.
Fixed missing jobs when using unique keys within the same minute.
pg-boss 1044 changes
Breaking changes 31
Automatic migration from v9 or lower is unavailable; jobs must be moved manually via the API or a manual SQL migration.
cancel() now requires a queue name argument.
complete() now requires a queue name argument.
Queues must be created before API or direct SQL inserts work; queues have storage policies and apply default retry and retention policies to new jobs.
This fetch() option was removed in favor of policy queues.
The expired failed state was consolidated into failed.
fail() now requires a queue name argument.
The fetchCompleted() API function was removed as dead letter queues replace completion jobs.
getJobById() now requires a queue name argument, and its returned metadata contract was standardized.
This work() option was replaced by pollingIntervalSeconds.
The minimum required Node.js version is now 20.
Use schedule: false instead of noScheduling: true to disable scheduled cron jobs.
Use supervise: false instead of noSupervisor: true to disable maintenance.
The offComplete() API function was removed as dead letter queues replace completion jobs.
The onComplete option was removed from send() and insert() as dead letter queues replace completion jobs.
The onComplete() API function was removed as dead letter queues replace completion jobs.
Job and archive table columns were renamed to snake case, and the job table is partitioned by name.
This work() option replaces newJobCheckInterval and newJobCheckIntervalSeconds; its minimum value is 0.5 seconds.
The minimum required PostgreSQL version is now 13, and the pgcrypto extension dependency has been removed.
The default is now 2 retries, so handlers that are not idempotent may need retryLimit set to 0.
Use schedule: false to disable scheduled cron jobs; it replaces noScheduling: true.
sendOnce() was dropped in favor of policy queues.
sendSingleton() was dropped in favor of policy queues.
The short queue policy allows only one item to be queued in the created state, replacing sendSingleton() and sendOnce().
The singleton queue policy allows only one active item, replacing the fetch() option enforceSingletonQueueActiveLimit.
The renamed close option now defaults to true.
The stop() option destroy was renamed to close; close defaults to true rather than leaving the internal connection open.
stop() now waits for the default graceful stop timeout of 30 seconds before resolving; set wait to false for the original behavior.
Use supervise: false to disable maintenance; it replaces noSupervisor: true.
This work() option was removed to simplify worker polling use cases.
The handler now always receives an array of jobs, including when processing a single job.
New APIs and options 9
A deadLetter option was added to send(), insert(), and createQueue(); failed jobs can be copied to optional dead letter queues after exhausting retries.
Added deleteJob() to provide fetch-then-delete semantics when job throttling or storage is not desired.
Added priority: false to opt out of priority sorting during job fetching, which may improve fetch performance for large queues not using priorities.
Added isInstalled().
Added maintain() for serverless or externally scheduled maintenance use cases.
The constructor option migrate: false prevents an instance from attempting to migrate to the latest database schema version.
Added schemaVersion().
Added an id option to pre-assign a job id when sending.
The stately queue policy combines short and singleton behavior, allowing only one queued job and one active job.
Behavior and default changes 3
insert() inherits supported settings from policy queues and then global constructor settings.
A primary key was added to the job archive table to support replication use cases such as read replicas or high availability standbys.
send() inherits supported settings from policy queues and then global constructor settings.
Fixes and other changes 1
Prevents singleton/stately batches from activating twice.