NeonN
Neon15mo ago
6 replies
primary-violet

Terminating connection due to administrator command

hi! We are using drizzle + node in aws lambda and we are constantly hit by the Terminating connection due to administrator command error. I understand why it happens due to neon compute being suspended due to inactivity.

From my understanding the best solution is for the client to reconnect to the db in case when this happens, however i'm not exactly sure how to achieve this following the neon docs.

Here is how db connection pool is created:

import { drizzle } from 'drizzle-orm/neon-serverless'

const pool = new Pool({
  connectionString: "myconnectionstring",
});
const db = drizzle(pool, { schema: { ...schema, ...relations } });


And I am very curious can the Terminating connection due to administrator command error be accounted for in this setup, thanks in advance.

PS. connection string does NOT have -pooled at the end. Should it?
Was this page helpful?