From f4803a7451adbbe5b4bc6b83c18e1812199b8049 Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Fri, 21 Nov 2025 16:35:52 +0000 Subject: [PATCH] Fix error when fetching router and stats information Add missing `api_port` and `last_sync` columns to the `routers` table in the database to resolve `column "last_sync" does not exist` errors. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: ed8286cc-22d7-40bd-ae28-6bae4dd7f5ea Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/C4ZJnmQ --- ...ckground-m-1763742923159_1763742923159.txt | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 attached_assets/Pasted-5-34-05-PM-express-POST-api-ml-train-200-in-6ms-message-Training-avviato-in-background-m-1763742923159_1763742923159.txt diff --git a/attached_assets/Pasted-5-34-05-PM-express-POST-api-ml-train-200-in-6ms-message-Training-avviato-in-background-m-1763742923159_1763742923159.txt b/attached_assets/Pasted-5-34-05-PM-express-POST-api-ml-train-200-in-6ms-message-Training-avviato-in-background-m-1763742923159_1763742923159.txt new file mode 100644 index 0000000..7e14e06 --- /dev/null +++ b/attached_assets/Pasted-5-34-05-PM-express-POST-api-ml-train-200-in-6ms-message-Training-avviato-in-background-m-1763742923159_1763742923159.txt @@ -0,0 +1,79 @@ +5:34:05 PM [express] POST /api/ml/train 200 in 6ms :: {"message":"Training avviato in background","m… +5:34:05 PM [express] GET /api/training-history 304 in 13ms :: [] +5:34:05 PM [express] GET /api/ml/stats 304 in 15ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:15 PM [express] GET /api/training-history 304 in 13ms :: [] +5:34:15 PM [express] GET /api/ml/stats 304 in 17ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:21 PM [express] GET /api/detections 304 in 2ms :: [] +5:34:23 PM [express] GET /api/training-history 304 in 3ms :: [] +5:34:23 PM [express] GET /api/ml/stats 304 in 16ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:31 PM [express] GET /api/detections 304 in 3ms :: [] +5:34:32 PM [express] GET /api/training-history 304 in 2ms :: [] +5:34:32 PM [express] GET /api/ml/stats 304 in 17ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:39 PM [express] GET /api/detections 304 in 2ms :: [] +5:34:41 PM [express] GET /api/training-history 304 in 2ms :: [] +5:34:41 PM [express] GET /api/ml/stats 304 in 16ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:42 PM [express] GET /api/detections 304 in 2ms :: [] +5:34:43 PM [express] GET /api/training-history 304 in 2ms :: [] +5:34:43 PM [express] GET /api/ml/stats 304 in 15ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:44 PM [express] GET /api/training-history 304 in 3ms :: [] +5:34:44 PM [express] GET /api/ml/stats 304 in 16ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:45 PM [express] GET /api/training-history 304 in 2ms :: [] +5:34:45 PM [express] GET /api/ml/stats 304 in 16ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:55 PM [express] GET /api/training-history 304 in 12ms :: [] +5:34:55 PM [express] GET /api/ml/stats 304 in 14ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:34:59 PM [express] GET /api/detections 304 in 3ms :: [] +[DB ERROR] Failed to fetch stats: error: column "last_sync" does not exist + at /opt/ids/node_modules/pg-pool/index.js:45:11 + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + at async (/opt/ids/node_modules/src/node-postgres/session.ts:104:19) + at async DatabaseStorage.getAllRouters (/opt/ids/server/storage.ts:58:12) + at async (/opt/ids/server/routes.ts:139:23) { + length: 109, + severity: 'ERROR', + code: '42703', + detail: undefined, + hint: undefined, + position: '83', + internalPosition: undefined, + internalQuery: undefined, + where: undefined, + schema: undefined, + table: undefined, + column: undefined, + dataType: undefined, + constraint: undefined, + file: 'parse_relation.c', + line: '3562', + routine: 'errorMissingColumn' +} +5:35:01 PM [express] GET /api/stats 500 in 4ms :: {"error":"Failed to fetch stats"} +5:35:01 PM [express] GET /api/detections 304 in 14ms :: [] +[DB ERROR] Failed to fetch routers: error: column "last_sync" does not exist + at /opt/ids/node_modules/pg-pool/index.js:45:11 + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + at async (/opt/ids/node_modules/src/node-postgres/session.ts:104:19) + at async DatabaseStorage.getAllRouters (/opt/ids/server/storage.ts:58:12) + at async (/opt/ids/server/routes.ts:10:23) { + length: 109, + severity: 'ERROR', + code: '42703', + detail: undefined, + hint: undefined, + position: '83', + internalPosition: undefined, + internalQuery: undefined, + where: undefined, + schema: undefined, + table: undefined, + column: undefined, + dataType: undefined, + constraint: undefined, + file: 'parse_relation.c', + line: '3562', + routine: 'errorMissingColumn' +} +5:35:01 PM [express] GET /api/routers 500 in 13ms :: {"error":"Failed to fetch routers"} +5:35:06 PM [express] GET /api/training-history 304 in 3ms :: [] +5:35:06 PM [express] GET /api/ml/stats 304 in 17ms :: {"logs":{"total":0,"last_hour":0},"detections"… +5:35:16 PM [express] GET /api/training-history 304 in 11ms :: [] +5:35:16 PM [express] GET /api/ml/stats 304 in 16ms :: {"logs":{"total":0,"last_hour":0},"detections"… \ No newline at end of file