Skip to content

Dashboard SPA in v1.1.0 calls endpoints that don't exist or are broken in the bundled server #26 #27

@daoom

Description

@daoom

The dashboard SPA shipped in @fozikio/cortex-engine@1.1.0 (public/index.html + assets/index-D3FMEJF5.js) calls REST endpoints that the bundled server (dist/rest/server.js) either does not register or cannot serve, causing the UI to render briefly then crash.

Reproduction

docker run --rm -p 3100:3100
-e CORTEX_API_TOKEN=test
-e OPENROUTER_API_KEY=anything
node:20 sh -c "npm i -g @fozikio/cortex-engine@1.1.0 && fozikio serve --rest --port 3100 --token test"

//In another shell:
curl -H "Authorization: Bearer test" http://localhost:3100/api/concepts
// → 404 {"error":"Not found: GET /api/concepts"}

curl -H "Authorization: Bearer test" http://localhost:3100/api/coherence
// → 500 {"error":"Internal server error"}

Server logs for /api/coherence

[rest] unhandled error: Error: Missing required string argument: prediction_id
at str (.../tools/_helpers.js:10:15)
at Object.handler (.../tools/validate.js:20:30)
at invokeTool (.../rest/server.js:106:17)
at Object.handler (.../rest/server.js:188:26)

The /api/coherence handler at dist/rest/server.js:187 invokes the validate tool, but validate requires a prediction_id argument that the route handler doesn't supply.

Browser console (loading the dashboard)

GET /api/concepts → 404
GET /api/coherence → 500
Uncaught TypeError: Cannot read properties of undefined (reading 'toLocaleString')
at NO (index-D3FMEJF5.js:9:246839)

The SPA reads .toLocaleString() on data it expected from one of the failing endpoints, then unmounts.

Expected

Either:

  • Register /api/concepts and fix /api/coherence to call validate with the correct arguments (or call a different
    tool), or
  • Ship a dashboard build that matches the endpoints the server actually exposes.

Environment

  • @fozikio/cortex-engine 1.1.0 (latest on npm)
  • Node 20-bookworm-slim
  • Server reports: {"status":"ok","version":"1.1.0","store":"sqlite","tools":57}
  • All other endpoints (/api/stats, /api/memories, /api/vitals, /api/home) work correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions