Improve production environment diagnostics and error handling

Add diagnostic scripts and enhance server configuration to better identify and resolve production issues, including 502 errors and static file serving problems.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 54292eb6-296c-47a3-8f4e-c9967863556c
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
michaelschal committed 2025-08-11 16:00:33 +00:00
1 parent 8256d0b965
commit 464eb0bfad
3 files changed
+125 -2

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env node
// Script de diagnostic pour la production LogiFlow
// Usage: node debug-production.js [URL_BASE]
const url = process.argv[2] || 'https://logiflow.ffnancy.fr';
const runDiagnostics = async () => {
console.log(`🔍 Diagnostic de production pour ${url}\n`);
const endpoints = [
{ path: '/api/health', desc: 'Health Check' },
{ path: '/api/user', desc: 'API User (attendu: 401)' },
{ path: '/api/default-credentials-check', desc: 'Credentials Check' },
{ path: '/', desc: 'Page principale' },
{ path: '/sav', desc: 'Page SAV' }
];
for (const endpoint of endpoints) {
try {
console.log(`📡 Test ${endpoint.desc}: ${url}${endpoint.path}`);
const response = await fetch(`${url}${endpoint.path}`, {
method: 'GET',
headers: {
'User-Agent': 'LogiFlow-Debug/1.0'
}
});
console.log(` Status: ${response.status} ${response.statusText}`);
if (endpoint.path === '/api/health' && response.ok) {
const data = await response.json();
console.log(` Détails:`, data);
}
if (response.status === 502) {
console.log(` ❌ Erreur 502: Service indisponible ou problème de proxy`);
} else if (response.ok || response.status === 401) {
console.log(` ✅ Service répond correctement`);
} else {
console.log(` ⚠️ Status inattendu`);
}
} catch (error) {
console.log(` ❌ Erreur de connexion: ${error.message}`);
}
console.log('');
}
console.log('🔧 Actions recommandées:');
console.log('1. Vérifier les logs Docker: docker-compose logs logiflow');
console.log('2. Vérifier le status: docker-compose ps');
console.log('3. Redémarrer si nécessaire: docker-compose restart logiflow');
console.log('4. Forcer rebuild: docker-compose up --build -d');
};
runDiagnostics().catch(console.error);