From c55ec19939ec7b9717932cc92d2a715059de46b6 Mon Sep 17 00:00:00 2001 From: michaelschal <35957947-michaelschal@users.noreply.replit.com> Date: Wed, 3 Sep 2025 13:53:38 +0000 Subject: [PATCH] Update BAP webhook configuration URL and improve error handling Correct the webhook URL for BAP configuration in multiple files (client, server, migrations). Adjust server startup logic to prevent crashes due to database migration failures in production, and add more verbose logging for environment and database connection status. Reorder integrations in `.replit` file. Replit-Commit-Author: Agent Replit-Commit-Session-Id: cfbfe47c-0c9a-4ebf-8a41-2937407eccff Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cfbfe47c-0c9a-4ebf-8a41-2937407eccff/qkkp1hi --- .replit | 2 +- ...in-214ms-G-1756907545927_1756907545928.txt | 119 ++++++++++++++++++ client/src/components/Sidebar.tsx | 2 +- server/index.ts | 12 +- server/migrations.ts | 2 +- server/routes.ts | 2 +- server/storage.ts | 2 +- 7 files changed, 131 insertions(+), 10 deletions(-) create mode 100644 attached_assets/Pasted--PRODUCTION-User-not-found-with-username-admin-local-GET-api-announcements-304-in-214ms-G-1756907545927_1756907545928.txt diff --git a/.replit b/.replit index 853b5d3..758bc01 100644 --- a/.replit +++ b/.replit @@ -37,4 +37,4 @@ args = "npm run dev" waitForPort = 5000 [agent] -integrations = ["javascript_database==1.0.0", "javascript_object_storage==1.0.0", "javascript_log_in_with_replit==1.0.0"] +integrations = ["javascript_database==1.0.0", "javascript_log_in_with_replit==1.0.0", "javascript_object_storage==1.0.0"] diff --git a/attached_assets/Pasted--PRODUCTION-User-not-found-with-username-admin-local-GET-api-announcements-304-in-214ms-G-1756907545927_1756907545928.txt b/attached_assets/Pasted--PRODUCTION-User-not-found-with-username-admin-local-GET-api-announcements-304-in-214ms-G-1756907545927_1756907545928.txt new file mode 100644 index 0000000..26bd7cd --- /dev/null +++ b/attached_assets/Pasted--PRODUCTION-User-not-found-with-username-admin-local-GET-api-announcements-304-in-214ms-G-1756907545927_1756907545928.txt @@ -0,0 +1,119 @@ +❌ [PRODUCTION] User not found with username: admin_local + +GET /api/announcements 304 in 214ms + +GET /api/groups 304 in 122ms + +GET /api/user 304 in 6ms + +GET /api/users 304 in 15ms + +GET /api/user 304 in 4ms + +GET /api/user 304 in 5ms + +GET /api/backups 304 in 8ms + +❌ Erreur récupération config webhook BAP: error: relation "webhook_bap_config" does not exist + + at /app/node_modules/pg-pool/index.js:45:11 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + + at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22 + + at async DatabaseStorage.getWebhookBapConfig (file:///app/dist/index.js:2815:26) + + at async file:///app/dist/index.js:12402:22 { + + length: 117, + + severity: 'ERROR', + + code: '42P01', + + detail: undefined, + + hint: undefined, + + position: '97', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + +⚠️ Table webhook_bap_config n'existe pas, retour config par défaut + + constraint: undefined, + +GET /api/webhook-bap-config 200 in 8ms + + file: 'parse_relation.c', + + line: '1392', + + routine: 'parserOpenTable' + +} + +HEAD /api/health 200 in 1ms + +🔍 Test webhook BAP: { + + url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d' + +} + +🌐 Réponse test webhook: { status: 404, ok: false } + +❌ Erreur test webhook BAP: Error: HTTP 404: Not Found + + at file:///app/dist/index.js:12481:15 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + +POST /api/webhook-bap-config/test 500 in 97ms + +🔍 Test webhook BAP: { + + url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d' + +} + +❌ Erreur test webhook BAP: Error: HTTP 500: Internal Server Error + + at file:///app/dist/index.js:12481:15 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + +🌐 Réponse test webhook: { status: 500, ok: false } + +POST /api/webhook-bap-config/test 500 in 65ms + +🔍 Test webhook BAP: { + + url: 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d' + +} + +🌐 Réponse test webhook: { status: 404, ok: false } + +❌ Erreur test webhook BAP: Error: HTTP 404: Not Found + + at file:///app/dist/index.js:12481:15 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + +POST /api/webhook-bap-config/test 500 in 17ms + +HEAD /api/health 200 in 0ms \ No newline at end of file diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 4027bca..839e6bd 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -112,7 +112,7 @@ export default function Sidebar() { // Utiliser une URL par défaut si pas de configuration if (!webhookUrl) { - webhookUrl = "https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d"; + webhookUrl = "https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d"; } // Fermer le modal de sélection et ouvrir le modal d'attente diff --git a/server/index.ts b/server/index.ts index 27ccf50..7c41528 100644 --- a/server/index.ts +++ b/server/index.ts @@ -2,18 +2,20 @@ import express, { type Request, Response, NextFunction } from "express"; import { registerRoutes } from "./routes.js"; import { setupVite, serveStatic } from "./vite.js"; -// Run database migrations first +// Run database migrations first - FORCER EN PRODUCTION console.log('🔄 [STARTUP] Running database migrations...'); +console.log('🔍 [STARTUP] Environment:', process.env.NODE_ENV); +console.log('🔍 [STARTUP] Has DATABASE_URL:', !!process.env.DATABASE_URL); + try { const { runMigrations } = await import('./migrations.js'); await runMigrations(); console.log('✅ [STARTUP] Database migrations completed'); } catch (error) { console.error('❌ [STARTUP] Database migrations failed:', error); - // Ne pas arrêter l'app en développement - if (process.env.NODE_ENV === 'production') { - process.exit(1); - } + console.error('❌ [STARTUP] Error details:', JSON.stringify(error, null, 2)); + // NE PAS arrêter l'app pour éviter les boucles de redémarrage + console.warn('⚠️ [STARTUP] Continuing without migrations to avoid restart loop'); } // Initialize weather system diff --git a/server/migrations.ts b/server/migrations.ts index ad25715..f37d14d 100644 --- a/server/migrations.ts +++ b/server/migrations.ts @@ -51,7 +51,7 @@ export async function runMigrations() { INSERT INTO webhook_bap_config (name, webhook_url, description, is_active) SELECT 'Configuration BAP', - 'https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d', + 'https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d', 'Configuration par défaut pour envoi des fichiers BAP vers n8n', true WHERE NOT EXISTS (SELECT 1 FROM webhook_bap_config);` diff --git a/server/routes.ts b/server/routes.ts index 7165907..122da86 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -95,7 +95,7 @@ export async function registerRoutes(app: Express): Promise { return res.json({ id: 1, name: "Configuration BAP", - webhookUrl: "https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d", + webhookUrl: "https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d", description: "Configuration par défaut (table non créée)", isActive: true, needsTableCreation: true diff --git a/server/storage.ts b/server/storage.ts index ffbe620..53b6ef6 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -3896,7 +3896,7 @@ export class MemStorage implements IStorage { return { id: 1, name: "Configuration BAP", - webhookUrl: "https://workflow.ffnancy.fr/webhook-test/a3d03176-b72f-412d-8fb9-f920b9fbab4d", + webhookUrl: "https://workflow.ffnancy.fr/webhook/a3d03176-b72f-412d-8fb9-f920b9fbab4d", description: "Configuration par défaut pour développement", isActive: true, createdAt: new Date(),