Merge pull request #70 from christianlouis/copilot/debug-backend-url-on-startup
feat: log BACKEND_URL at frontend startup and include target URL in proxy errors
This commit is contained in:
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Upgraded `sqlalchemy` from `2.0.25` to `2.0.48` to fix `AssertionError: Class ... directly inherits TypingOnly but has additional attributes` on Python 3.14 (`__static_attributes__`, `__firstlineno__`)
|
||||
|
||||
### Added
|
||||
- **Backend URL logged at startup**: The Next.js server now logs the resolved `BACKEND_URL` (e.g. `[proxy] BACKEND_URL = http://backend:8000`) via `src/instrumentation.ts` when the server starts, making it easy to diagnose `ECONNREFUSED` proxy errors. The per-request error log now also includes the full target URL.
|
||||
- **Dual-registry Docker deployment**: CI now builds separate backend and frontend images and pushes to both GHCR (`ghcr.io`) and private registry (`registry.cklnet.com`) using a matrix strategy
|
||||
- **Database-backed configuration**: `AppSetting` model and `ConfigService` for hybrid config (DB-first, env-var fallback)
|
||||
- Admin API endpoints for managing settings (`GET/PUT/DELETE /api/v1/settings`)
|
||||
|
||||
@@ -99,6 +99,7 @@ Comprehensive task breakdown for repository improvements and production readines
|
||||
- [x] Upgrade SQLAlchemy to 2.0.48 to fix Python 3.14 test failures
|
||||
- [x] Fix Docker build failure: wrap `useSearchParams()` in Suspense boundary in `/auth/callback` page
|
||||
- [x] Fix frontend API URL hardcoded to `localhost:8000` in production: replaced build-time `NEXT_PUBLIC_API_URL` with a runtime Next.js Route Handler proxy (`/api/v1/[...path]`) reading `BACKEND_URL` at server startup
|
||||
- [x] Log `BACKEND_URL` at frontend server startup and include target URL in per-request proxy error messages
|
||||
|
||||
### In Progress 🔨
|
||||
- [ ] Configure branch protection rules
|
||||
|
||||
@@ -29,7 +29,7 @@ async function handler(request: NextRequest, context: RouteContext) {
|
||||
headers: upstream.headers,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Proxy error forwarding to backend:", error);
|
||||
console.error(`Proxy error forwarding to backend (target: ${targetUrl}):`, error);
|
||||
return NextResponse.json({ detail: "Backend unavailable" }, { status: 502 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export async function register() {
|
||||
const backendUrl = process.env.BACKEND_URL ?? "http://localhost:8000";
|
||||
console.log(`[proxy] BACKEND_URL = ${backendUrl}`);
|
||||
}
|
||||
Reference in New Issue
Block a user