fix(dashboard): return 404 for event streams of unknown projects
An SSE subscription with a nonexistent projectId (stale client tab, e2e fixture page using projectId "fixture") surfaced the PG startup-factory construction chain as a 500 on every poll, filling operator logs with alarming "failed to construct TaskStore" errors. Map project-not-found to a clean 404, matching the project routes' existing handling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
7
.changeset/events-unknown-project-404.md
Normal file
7
.changeset/events-unknown-project-404.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@runfusion/fusion": patch
|
||||
---
|
||||
|
||||
summary: Dashboard event streams for an unknown project now return 404 instead of logging a 500 server error.
|
||||
category: fix
|
||||
dev: `/api/events` maps project-not-found store-resolution failures to 404 with a clean message; stale client tabs and e2e fixture pages no longer fill operator logs with startup-factory construction errors.
|
||||
@@ -1285,7 +1285,20 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
|
||||
automationStore,
|
||||
)(req, res);
|
||||
} catch (err: unknown) {
|
||||
sendErrorResponse(res, 500, err instanceof Error ? err.message : "Failed to open project event stream");
|
||||
/*
|
||||
FNXC:ProjectScoping 2026-08-16-05:28:
|
||||
An SSE subscription for a nonexistent project (e.g. a stale client tab or an
|
||||
e2e fixture page using projectId "fixture") is a client addressing error, not a
|
||||
server fault. Surfacing the startup-factory construction chain as a 500 filled
|
||||
operator logs with alarming "failed to construct TaskStore" errors on every
|
||||
poll; map project-not-found to 404 with a clean message instead.
|
||||
*/
|
||||
const message = err instanceof Error ? err.message : "Failed to open project event stream";
|
||||
if (/Project (?:"[^"]*" )?not found/.test(message)) {
|
||||
sendErrorResponse(res, 404, `Project "${projectId}" not found`);
|
||||
return;
|
||||
}
|
||||
sendErrorResponse(res, 500, message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user