diff --git a/server/src/plugins/service-admin-http/index.ts b/server/src/plugins/service-admin-http/index.ts index 3448b9b..04a1326 100644 --- a/server/src/plugins/service-admin-http/index.ts +++ b/server/src/plugins/service-admin-http/index.ts @@ -195,7 +195,19 @@ export class Plugin extends BSBService, typeof Event otaImportApiKey: this.config.otaImportApiKey || undefined, }; - const app = new H3(); + const app = new H3({ + onError: (error, event) => { + const status = error.status ?? 500; + const path = event.req.url ?? "unknown"; + if (status >= 500) { + obs.log.warn("HTTP {status} {path}: {err}", { + status, + path, + err: error.message ?? String(error), + }); + } + }, + }); registerMiddleware(app, deps); registerStaticRoutes(app); diff --git a/server/src/plugins/service-api-http/index.ts b/server/src/plugins/service-api-http/index.ts index ed706f2..3525b6e 100644 --- a/server/src/plugins/service-api-http/index.ts +++ b/server/src/plugins/service-api-http/index.ts @@ -164,7 +164,19 @@ export class Plugin extends BSBService, typeof Event }, ); - const app = new H3(); + const app = new H3({ + onError: (error, event) => { + const status = error.status ?? 500; + const path = event.req.url ?? "unknown"; + if (status >= 500) { + obs.log.warn("HTTP {status} {path}: {err}", { + status, + path, + err: error.message ?? String(error), + }); + } + }, + }); app.get("/api/kiosk/_check", async (event) => { const token = extractBearerToken(event);