Open
Description
Not sure there is anything to be done in the PG library but any tips in regards to investigating this issue further would be welcome.
We connect to a NEON Postgres database like so with node-pg.
const pool = new Pool({
connectionString: 'postgresql://dbauszus:***@ep-curly-base-242741.eu-central-1.aws.neon.tech/neondb?sslmode=require',
connectionTimeoutMillis: 5000,
dbs: 'NEON',
idleTimeoutMillis: 30000, // 5 seconds
keepAlive: true, // 30 seconds
max: 20, // Maximum number of clients in the pool
});
client = await pool.connect();
This works well testing on local and when deployed to vercel.
On stackblitz however this fails in the requestSsl method.
{
err: Error: Connection terminated due to connection timeout
at eval (/home/dbauszus-glx/xyz_dev/node_modules/pg-pool/index.js:45:11)
at <anonymous> (https://xyzdev-mrwe.w-credentialless-staticblitz.com/blitz.55edb8f4.js:31:28929) {
[cause]: Error: Connection terminated unexpectedly
at Connection.eval (/home/dbauszus-glx/xyz_dev/node_modules/pg/lib/client.js:136:73)
at Object.onceWrapper (node:events:30:8244)
at Connection.emit (node:events:30:11034)
at Socket.eval (/home/dbauszus-glx/xyz_dev/node_modules/pg/lib/connection.js:62:12)
at Socket.emit (node:events:30:11034)
at <anonymous> (node:net:292:3722)
at <anonymous> (https://xyzdev-mrwe.w-credentialless-staticblitz.com/blitz.55edb8f4.js:31:295130)
},
pool: 'NEON',
query: '\n' +
' SELECT\n' +
' id AS id\n' +
' , ST_AsText(geom_3857) AS geometry\n' +
' FROM scratch\n' +
' WHERE TRUE AND geom_3857 IS NOT NULL ;',
retry: 1,
variables: []
}
TypeError: Cannot perform Construct on a detached ArrayBuffer
at new Uint8Array (<anonymous>)
at new FastBuffer (https://xyzdev-mrwe.w-credentialless-staticblitz.com/builtins.97a3df4f.js:55:12767)
at allocate (https://xyzdev-mrwe.w-credentialless-staticblitz.com/builtins.97a3df4f.js:19:5565)
at Buffer.allocUnsafe (https://xyzdev-mrwe.w-credentialless-staticblitz.com/builtins.97a3df4f.js:19:5621)
at Object.requestSsl (file:///home/dbauszus-glx/xyz_dev/node_modules/pg-protocol/dist/serializer.js#cjs:19:29)
at Connection.requestSsl (file:///home/dbauszus-glx/xyz_dev/node_modules/pg/lib/connection.js#cjs:121:33)
at Connection.eval (file:///home/dbauszus-glx/xyz_dev/node_modules/pg/lib/client.js#cjs:123:13)
at Connection.emit (https://xyzdev-mrwe.w-credentialless-staticblitz.com/builtins.97a3df4f.js:30:11034)
at Socket.eval (file:///home/dbauszus-glx/xyz_dev/node_modules/pg/lib/connection.js#cjs:49:12)
at Object.onceWrapper (https://xyzdev-mrwe.w-credentialless-staticblitz.com/builtins.97a3df4f.js:30:8244)
Metadata
Metadata
Assignees
Labels
No labels