From abc8d6299fcf3dd4212b6589944e6d024d64c631 Mon Sep 17 00:00:00 2001 From: Fwseyi Date: Sun, 28 Jun 2026 23:09:05 +0100 Subject: [PATCH 1/3] fix: add uptimeSeconds and ISO timestamp to health endpoint --- apps/api/src/routes/public.test.ts | 2 ++ apps/api/src/routes/public.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/api/src/routes/public.test.ts b/apps/api/src/routes/public.test.ts index 1b2dec0..771f747 100644 --- a/apps/api/src/routes/public.test.ts +++ b/apps/api/src/routes/public.test.ts @@ -41,6 +41,8 @@ describe("public routes", () => { timestamp: "2026-06-21T10:00:00.000Z" }); expect(typeof response.body.sponsorshipEnabled).toBe("boolean"); + expect(typeof response.body.uptimeSeconds).toBe("number"); + expect(response.body.uptimeSeconds).toBeGreaterThanOrEqual(0); } finally { vi.useRealTimers(); } diff --git a/apps/api/src/routes/public.ts b/apps/api/src/routes/public.ts index c27a754..07092ba 100644 --- a/apps/api/src/routes/public.ts +++ b/apps/api/src/routes/public.ts @@ -27,7 +27,8 @@ publicRouter.get("/health", (_req, res) => { nodeEnv: config.NODE_ENV, network: config.STELLAR_NETWORK, sponsorshipEnabled: config.sponsorshipEnabled, - timestamp: new Date().toISOString() + timestamp: new Date().toISOString(), + uptimeSeconds: process.uptime() }); }); From 09499afc1fb511537aba7a33ef9b2ca010eda030 Mon Sep 17 00:00:00 2001 From: Fwseyi Date: Sun, 28 Jun 2026 23:21:01 +0100 Subject: [PATCH 2/3] docs: add API_BASE_URL troubleshooting section for agent client --- README.MD | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.MD b/README.MD index b5abd01..df1c590 100644 --- a/README.MD +++ b/README.MD @@ -356,3 +356,43 @@ Judge talking points (30-second version): - [x] Usage + spend analytics - [x] Env + setup docs - [x] Frontend dashboard + +## Troubleshooting + +### Agent client fails with a network error + +If the agent client throws a connection error such as `ECONNREFUSED` or `fetch failed`, the most common cause is that the API server is not running or `API_BASE_URL` is pointing to the wrong address. + +**1. Confirm the API server is running** + +Open a terminal and start the API: + +```sh +npm run dev --workspace @query402/api +``` + +The server should log something like `Listening on http://localhost:3000`. + +**2. Set `API_BASE_URL` for local development** + +The agent client reads `API_BASE_URL` from the environment. For local development it should point to the API server: + +```sh +export API_BASE_URL=http://localhost:3000 +``` + +Or add it to a `.env` file in `apps/agent-client/`: + +```sh +API_BASE_URL=http://localhost:3000 +``` + +**3. Run the agent demo** + +Once the API is running and `API_BASE_URL` is set, start the agent demo: + +```sh +npm run demo --workspace @query402/agent-client +``` + +**Note:** Never commit real private keys or funded wallet secrets to `.env` files. Use testnet keys only for local development. From 9c1482bb426e302589c0f1dea8982f4d722249e2 Mon Sep 17 00:00:00 2001 From: Fwseyi Date: Mon, 29 Jun 2026 22:28:08 +0100 Subject: [PATCH 3/3] docs: fix API port from 3000 to 3001 in troubleshooting section --- README.MD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.MD b/README.MD index df1c590..153944e 100644 --- a/README.MD +++ b/README.MD @@ -371,20 +371,20 @@ Open a terminal and start the API: npm run dev --workspace @query402/api ``` -The server should log something like `Listening on http://localhost:3000`. +The server should log something like `Listening on http://localhost:3001`. **2. Set `API_BASE_URL` for local development** The agent client reads `API_BASE_URL` from the environment. For local development it should point to the API server: ```sh -export API_BASE_URL=http://localhost:3000 +export API_BASE_URL=http://localhost:3001 ``` Or add it to a `.env` file in `apps/agent-client/`: ```sh -API_BASE_URL=http://localhost:3000 +API_BASE_URL=http://localhost:3001 ``` **3. Run the agent demo**