fix: harden telemetry parsing and null node fallbacks

This commit is contained in:
SaelixCode
2026-03-18 20:31:57 -04:00
parent 7f23c88c73
commit f1f8e34da5
5 changed files with 53 additions and 2 deletions
+10
View File
@@ -67,6 +67,16 @@ const nodeContextMiddleware = (req: Request, res: Response, next: NextFunction)
} else {
req.nodeId = NodeRegistry.getInstance().getDefaultNodeId();
}
// Intercept requests to deleted nodes to prevent downstream errors
if (req.path.startsWith('/api/') && !req.path.startsWith('/api/auth/')) {
const node = DatabaseService.getInstance().getNode(req.nodeId);
if (!node) {
res.status(404).json({ error: `Node with id ${req.nodeId} not found or was deleted.` });
return;
}
}
next();
};