tests cannot connect to db
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m5s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m5s
This commit is contained in:
24
server.ts
24
server.ts
@@ -125,4 +125,26 @@ app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
|||||||
const PORT = process.env.PORT || 3001;
|
const PORT = process.env.PORT || 3001;
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
logger.info(`Authentication server started on port ${PORT}`);
|
logger.info(`Authentication server started on port ${PORT}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// --- START ROUTE DEBUGGING ---
|
||||||
|
// On server startup, print all registered routes to the console.
|
||||||
|
// This helps debug 404s by showing exactly what Express thinks the routes are.
|
||||||
|
const routes: { method: string, path: string }[] = [];
|
||||||
|
app._router.stack.forEach((middleware: any) => {
|
||||||
|
if (middleware.route) { // routes registered directly on the app
|
||||||
|
routes.push({
|
||||||
|
method: Object.keys(middleware.route.methods).join(', ').toUpperCase(),
|
||||||
|
path: middleware.route.path
|
||||||
|
});
|
||||||
|
} else if (middleware.name === 'router') { // router instances
|
||||||
|
middleware.handle.stack.forEach((handler: any) => {
|
||||||
|
const route = handler.route;
|
||||||
|
route && routes.push({ method: Object.keys(route.methods).join(', ').toUpperCase(), path: `${middleware.regexp.source.replace('\\/?(?=\\/|$)', '').slice(1)}${route.path}`});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log('--- REGISTERED API ROUTES ---');
|
||||||
|
console.table(routes);
|
||||||
|
console.log('-----------------------------');
|
||||||
|
// --- END ROUTE DEBUGGING ---
|
||||||
@@ -44,6 +44,8 @@ router.post('/process-flyer', optionalAuth, upload.array('flyerImages'), async (
|
|||||||
mimetype: file.mimetype
|
mimetype: file.mimetype
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
logger.debug(`[API /ai/process-flyer] Processing image paths:`, { imagePaths });
|
||||||
|
|
||||||
const user = req.user as UserProfile | undefined;
|
const user = req.user as UserProfile | undefined;
|
||||||
const logIdentifier = user ? `user ID: ${user.id}` : 'anonymous user';
|
const logIdentifier = user ? `user ID: ${user.id}` : 'anonymous user';
|
||||||
|
|
||||||
|
|||||||
@@ -1280,7 +1280,7 @@ export async function deleteUserAccount(password: string, tokenOverride?: string
|
|||||||
errorMessage = data.message || errorMessage;
|
errorMessage = data.message || errorMessage;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// Response was not JSON (likely 404 HTML or 500 text)
|
// Response was not JSON (likely 404 HTML or 500 text)
|
||||||
const text = await response.text();
|
const text = await response.clone().text(); // Use clone() to avoid "Body already read" error
|
||||||
logger.error(`deleteUserAccount failed with status ${response.status}. Body: ${text}`);
|
logger.error(`deleteUserAccount failed with status ${response.status}. Body: ${text}`);
|
||||||
errorMessage += `: ${response.status} ${response.statusText}`;
|
errorMessage += `: ${response.status} ${response.statusText}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user