fix(bridge): strip duplicate /api prefix in BaserowClient base URL
Some checks failed
CI / Lint bridge (Biome) (push) Has been cancelled
CI / Security scan (push) Has been cancelled
E2E Playwright / Playwright e2e (chromium) (push) Has been cancelled
CI / Type-check bridge (push) Has been cancelled
CI / Tests unit bridge (push) Has been cancelled
CI / Tests integration bridge (push) Has been cancelled
CI / Docker build + healthcheck (push) Has been cancelled

BASEROW_API_URL is http://baserow:80/api and every BaserowClient path is
written with an /api/... prefix, producing http://baserow:80/api/api/...
-> Baserow 404 on all /views/:id/data and /views/table/:id calls (admin
client was unaffected: its paths omit /api). Normalize the base to
host-only so the /api/... paths resolve correctly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Corentin JOGUET 2026-05-18 11:38:44 +00:00
parent 617411e5b6
commit dca6936ee7

View file

@ -37,7 +37,12 @@ export class BaserowClient {
private readonly logger: Logger;
constructor(opts: { baseUrl: string; token: string; logger: Logger }) {
this.baseUrl = opts.baseUrl.replace(/\/$/, '');
// Every path in this client is written with the `/api/...` prefix
// (e.g. `/api/database/rows/table/:id/`). BASEROW_API_URL is configured
// as `http://baserow:80/api`, so a naive join would yield a double
// `/api/api/...` and Baserow returns 404. Strip a trailing `/api` (and
// slashes) so the base is host-only, robust to either env form.
this.baseUrl = opts.baseUrl.replace(/\/+$/, '').replace(/\/api$/, '');
this.token = opts.token;
this.logger = opts.logger.child({ adapter: 'baserow' });
}