payloadcms / payloadcms/payload

Payload Postgres adapter: `Uncaught Exception: error: terminating connection due to administrator command`

Open
#16,939 2 comments 0 reactions 1 assignee View on GitHub

@r1tsuu is already working on this.

Since Aug 27, 2026.

db: postgres invalid-reproduction stale v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

I am using Vercel, Vercel Blob and NeonDB together with Payload CMS.

I believe there is a fault in unhandled exceptions by the Payload CMS code, it looks like this:

Uncaught Exception: error: terminating connection due to administrator command
    at parseErrorMessage (/var/task/node_modules/pg-protocol/dist/parser.js:305:11)
    at Parser.handlePacket (/var/task/node_modules/pg-protocol/dist/parser.js:143:27)
    at Parser.parse (/var/task/node_modules/pg-protocol/dist/parser.js:37:38)
    at TLSSocket.<anonymous> (/var/task/node_modules/pg-protocol/dist/index.js:11:42)
    at TLSSocket.emit (node:events:508:28)
    at addChunk (node:internal/streams/readable:563:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:514:3)
    at Readable.push (node:internal/streams/readable:394:5)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:189:23)
error: terminating connection due to administrator command
    at ignore-listed frames {
  length: 116,
  severity: 'FATAL',
  code: '57P01',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'postgres.c',
  line: '3357',
  routine: 'ProcessInterrupts',
  client: Client {
    _events: [Object: null prototype] { error: [Function (anonymous)] },
    _eventsCount: 1,
    _maxListeners: undefined,
    connectionParameters: ConnectionParameters {
      user: 'neondb_owner',
      database: 'neondb',
      port: 5432,
      host: 'ep-bitter-mountain-alzq0ff1.c-3.eu-central-1.aws.neon.tech',
      binary: false,
      options: undefined,
      ssl: {},
      client_encoding: '',
      replication: undefined,
      isDomainSocket: false,
      application_name: undefined,
      fallback_application_name: undefined,
      statement_timeout: false,
      lock_timeout: false,
      idle_in_transaction_session_timeout: false,
      query_timeout: false,
      connect_timeout: 0
    },
    user: 'neondb_owner',
    database: 'neondb',
    port: 5432,
    host: 'ep-bitter-mountain-alzq0ff1.c-3.eu-central-1.aws.neon.tech',
    replication: undefined,
    _Promise: [Function: Promise],
    _types: TypeOverrides { _types: [Object], text: {}, binary: {} },
    _ending: true,
    _ended: false,
    _connecting: false,
    _connected: true,
    _connectionError: false,
    _queryable: false,
    _activeQuery: null,
    enableChannelBinding: false,
    connection: Connection {
      _events: [Object: null prototype],
      _eventsCount: 23,
      _maxListeners: undefined,
      stream: [TLSSocket],
      _keepAlive: false,
      _keepAliveInitialDelayMillis: 0,
      parsedStatements: {},
      ssl: {},
      _ending: true,
      _emitMessage: false,
      _connecting: true,
      Symbol(shapeMode): false,
      Symbol(kCapture): false
    },
    _queryQueue: [],
    binary: false,
    processID: 1115258111,
    secretKey: -1714563207,
    ssl: {},
    _connectionTimeoutMillis: 0,
    _connectionCallback: null,
    saslSession: null,
    release: [Function (anonymous)],
    readyForQuery: true,
    hasExecuted: true,
    _poolUseCount: 4,
    Symbol(shapeMode): false,
    Symbol(kCapture): false
  }
}
Node.js process exited with exit status: 129. The logs above can help with debugging the issue.

Neon claims:

Your Node.js application is exiting because it's not handling the connection error when Neon's compute suspends1. The pg client is emitting an unhandled error event when the connection is terminated2.

The solution is to use a connection pool instead of a single client2. A pool will handle connection loss gracefully and create new connections when needed2.

However as far as I am aware, the setup with Payload CMS is using a pool for the client. So I should not use the Neon pool.

Link to the code that reproduces this issue

http://example.com/

Reproduction Steps

I cannot reproduce this as it only happens sporadically and on a private code base. But I do see these logs in the Vercel Logs.

Which area(s) are affected?

db: postgres

Environment Info
> payload info
payload                                      payload info

Binaries:
  Node: 24.16.0
  npm: 11.13.0
  Yarn: N/A
  pnpm: 11.5.2
Relevant Packages:
  payload: 3.85.0
  next: 16.2.7
  @payloadcms/db-postgres: 3.85.0
  @payloadcms/drizzle: 3.85.0
  @payloadcms/email-resend: 3.85.0
  @payloadcms/graphql: 3.85.0
  @payloadcms/next/utilities: 3.85.0
  @payloadcms/plugin-cloud-storage: 3.85.0
  @payloadcms/richtext-lexical: 3.85.0
  @payloadcms/storage-vercel-blob: 3.85.0
  @payloadcms/translations: 3.85.0
  @payloadcms/ui/shared: 3.85.0
  react: 19.2.7
  react-dom: 19.2.7
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 31659
  Available CPU cores: 32

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.