Skip to content

metricsApiRoutes is exported but never mounted, so every client metric POST 404s #74

Description

@rclod

server/metrics.ts exports metricsApiRoutes with seven handlers:

/collab-reconnect, /mark-anchor, /mirror-file-creation, /library-claim, /auth-challenge, /deep-link-unhandled, /offline-edit-merge

server/index.ts never mounts the router, so all seven are unreachable and every metric the browser bundle posts 404s. The visible one is /api/metrics/mark-anchor, which src/bridge/share-client.ts (reportMarkAnchorResolution) posts on each anchor resolution — it shows up as repeated 404s in the console.

app.use("/api/metrics", metricsApiRoutes);

Mounting it ahead of the /api compatibility gate seems right: these are fire-and-forget posts from the bundle rather than versioned client API calls, and enforceApiClientCompatibility rejects them with 426 for a missing x-proof-client-build.

Verified locally — with the mount, the real client payload {"result":"success","source":"web"} returns {"success":true}; without it, 404.

Happy to send a PR.

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