Skip to content

[Frontend] Fix broken 'Indexer Last Ledger' fetch on settings page #455

Description

@ogazboiz

Join the discussion on Telegram

Why this matters

The settings page shows an "Indexer Last Ledger" row that is permanently broken. In frontend/src/app/settings/page.tsx:

const INDEXER_URL = process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001/v1";
// ...
const response = await fetch(`${INDEXER_URL}/health`);
const data = await response.json();
if (data.ledger) setLastLedger(data.ledger.toString());

Two problems:

  1. The health route is mounted at /health (root), not under /v1 (see backend/src/app.tsapp.use('/health', healthRoutes) and backend/src/routes/v1/index.ts). So ${API_URL}/v1/health (or /v1/v1/health depending on the env value) 404s.
  2. The health response (backend/src/routes/health.routes.ts) returns { status, db, indexerLag, uptime } — there is no ledger field. The actual last ledger lives in GET /v1/admin/metrics (indexer.lastLedger), which requires admin auth.

So the row always renders "Unknown"/"Unavailable"/"Error". Either expose the ledger somewhere reachable or remove the row.

Acceptance criteria

  • Pick one approach and implement it: (a) add a public, unauthenticated lastLedger field to the /health response and point the fetch at the correct /health path; or (b) add a small public indexer-status endpoint; or (c) remove the "Indexer Last Ledger" row if no public source is desired.
  • Fix the URL so it resolves regardless of whether NEXT_PUBLIC_API_URL ends in /v1.
  • Handle loading/error states so it never sticks on "Loading...".

Files to touch

  • frontend/src/app/settings/page.tsx
  • backend/src/routes/health.routes.ts (if exposing the field)

Out of scope

  • Reworking the full admin metrics endpoint.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't workingfrontendFrontend related tasks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions