From d63f776af065f4941839cf3782c55447e58f0de3 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 1 Oct 2025 15:00:13 +0000 Subject: [PATCH] Update database connection to use the standard pg driver Replaced `@neondatabase/serverless` with `pg` for database connections in `server/db.ts`, updating the `drizzle` initialization accordingly. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/Yxw6kHP --- .replit | 4 - ...ying-Pulli-1759330755322_1759330755322.txt | 200 ++++++++++++++++++ server/db.ts | 9 +- 3 files changed, 203 insertions(+), 10 deletions(-) create mode 100644 attached_assets/Pasted-Reading-config-file-app-drizzle-config-ts-Using-pg-driver-for-database-querying-Pulli-1759330755322_1759330755322.txt diff --git a/.replit b/.replit index 6391e70..3238a51 100644 --- a/.replit +++ b/.replit @@ -14,10 +14,6 @@ run = ["npm", "run", "start"] localPort = 5000 externalPort = 80 -[[ports]] -localPort = 38463 -externalPort = 3000 - [env] PORT = "5000" diff --git a/attached_assets/Pasted-Reading-config-file-app-drizzle-config-ts-Using-pg-driver-for-database-querying-Pulli-1759330755322_1759330755322.txt b/attached_assets/Pasted-Reading-config-file-app-drizzle-config-ts-Using-pg-driver-for-database-querying-Pulli-1759330755322_1759330755322.txt new file mode 100644 index 0000000..11aab07 --- /dev/null +++ b/attached_assets/Pasted-Reading-config-file-app-drizzle-config-ts-Using-pg-driver-for-database-querying-Pulli-1759330755322_1759330755322.txt @@ -0,0 +1,200 @@ +Reading config file '/app/drizzle.config.ts' + +Using 'pg' driver for database querying + +[⣷] Pulling schema from database... + +[✓] Pulling schema from database... + +[✓] Changes applied + +> rest-express@1.0.0 start + +> NODE_ENV=production node dist/index.js + +OPENROUTER_API_KEY not set. AI text generation will not work. + +2:57:45 PM [express] serving on port 5555 + +Scheduler service started + +Error processing pending posts: ErrorEvent { + + [Symbol(kTarget)]: WebSocket { + + _events: [Object: null prototype] { + + error: [Function], + + message: [Function], + + close: [Function], + + open: [Function] + + }, + + _eventsCount: 4, + + _maxListeners: undefined, + + _binaryType: 'arraybuffer', + + _closeCode: 1006, + + _closeFrameReceived: false, + + _closeFrameSent: false, + + _closeMessage: , + + _closeTimer: null, + + _errorEmitted: true, + + _extensions: {}, + + _paused: false, + + _protocol: '', + + _readyState: 3, + + _receiver: null, + + _sender: null, + + _socket: null, + + _bufferedAmount: 0, + + _isServer: false, + + _redirects: 0, + + _autoPong: true, + + _url: 'wss://postgres/v2', + + _req: null, + + [Symbol(shapeMode)]: false, + + [Symbol(kCapture)]: false + + }, + + [Symbol(kType)]: 'error', + + [Symbol(kError)]: Error: connect ECONNREFUSED 172.23.0.2:443 + + at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16) { + + errno: -111, + + code: 'ECONNREFUSED', + + syscall: 'connect', + + address: '172.23.0.2', + + port: 443 + + }, + + [Symbol(kMessage)]: 'connect ECONNREFUSED 172.23.0.2:443' + +} + +Error processing pending posts: ErrorEvent { + + [Symbol(kTarget)]: WebSocket { + + _events: [Object: null prototype] { + + error: [Function], + + message: [Function], + + close: [Function], + + open: [Function] + + }, + + _eventsCount: 4, + + _maxListeners: undefined, + + _binaryType: 'arraybuffer', + + _closeCode: 1006, + + _closeFrameReceived: false, + + _closeFrameSent: false, + + _closeMessage: , + + _closeTimer: null, + + _errorEmitted: true, + + _extensions: {}, + + _paused: false, + + _protocol: '', + + _readyState: 3, + + _receiver: null, + + _sender: null, + + _socket: null, + + _bufferedAmount: 0, + + _isServer: false, + + _redirects: 0, + + _autoPong: true, + + _url: 'wss://postgres/v2', + + _req: null, + + [Symbol(shapeMode)]: false, + + [Symbol(kCapture)]: false + + }, + + [Symbol(kType)]: 'error', + + [Symbol(kError)]: Error: connect ECONNREFUSED 172.23.0.2:443 + + at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16) { + + errno: -111, + + code: 'ECONNREFUSED', + + syscall: 'connect', + + address: '172.23.0.2', + + port: 443 + + }, + + [Symbol(kMessage)]: 'connect ECONNREFUSED 172.23.0.2:443' + +} + + + + + \ No newline at end of file diff --git a/server/db.ts b/server/db.ts index 7ca3d56..d74a15a 100644 --- a/server/db.ts +++ b/server/db.ts @@ -1,10 +1,7 @@ -import { Pool, neonConfig } from '@neondatabase/serverless'; -import { drizzle } from 'drizzle-orm/neon-serverless'; -import ws from "ws"; +import { Pool } from 'pg'; +import { drizzle } from 'drizzle-orm/node-postgres'; import * as schema from "@shared/schema"; -neonConfig.webSocketConstructor = ws; - if (!process.env.DATABASE_URL) { throw new Error( "DATABASE_URL must be set. Did you forget to provision a database?", @@ -12,4 +9,4 @@ if (!process.env.DATABASE_URL) { } export const pool = new Pool({ connectionString: process.env.DATABASE_URL }); -export const db = drizzle({ client: pool, schema }); \ No newline at end of file +export const db = drizzle(pool, { schema }); \ No newline at end of file