Fix 502 errors on container restart and expand API authentication

- Handle 502 Gateway Timeout errors by clearing invalid sessions
- Add graceful session validation failure handling in fetch-thread API
- Expand x-tag authentication to accept additional valid token
- Add debug logging to berth-related API endpoints
- Document the 502 error fix in email system documentation
This commit is contained in:
2025-06-09 23:29:24 +02:00
parent 1866dfd010
commit 48cee6f849
8 changed files with 89 additions and 28 deletions

View File

@@ -215,6 +215,17 @@ const loadEmails = async () => {
}
} catch (error: any) {
console.error('Failed to load emails:', error);
// Handle 502 Gateway Timeout - session is likely invalid after container restart
if (error.statusCode === 502 || error.status === 502) {
console.log('Got 502 error, clearing invalid session');
// Clear the invalid session
sessionStorage.removeItem('emailSessionId');
// Don't show error toast, just reset to no emails
threads.value = [];
return;
}
if (error.data?.statusMessage?.includes('Email credentials not found')) {
// Don't show error, parent component should handle reconnection
threads.value = [];