From 64e07d7bd033a4a384d8788d93b527db78eff94a Mon Sep 17 00:00:00 2001 From: Hoshino-Yumetsuki Date: Sat, 29 Aug 2026 17:44:17 +0800 Subject: [PATCH] fix: surface certificate resolver discovery errors Propagate SSH, filesystem, and YAML errors so unavailable resolver configuration is not mistaken for an empty one. Not-tested: Local checks unavailable because node_modules is missing --- .../server/src/utils/traefik/web-server.ts | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/packages/server/src/utils/traefik/web-server.ts b/packages/server/src/utils/traefik/web-server.ts index 943f56cc7..fd33f6dfe 100644 --- a/packages/server/src/utils/traefik/web-server.ts +++ b/packages/server/src/utils/traefik/web-server.ts @@ -113,28 +113,24 @@ export const readMainConfig = () => { export const getCertificateResolvers = async ( serverId?: string | null, ): Promise => { - try { - let yamlStr: string | null = null; - if (serverId) { - const { MAIN_TRAEFIK_PATH } = paths(true); - const configPath = join(MAIN_TRAEFIK_PATH, "traefik.yml"); - const { stdout } = await execAsyncRemote(serverId, `cat ${configPath}`); - yamlStr = stdout || null; - } else { - yamlStr = readMainConfig(); - } - if (!yamlStr) return []; - const config = parse(yamlStr) as MainTraefikConfig; - if ( - !config?.certificatesResolvers || - typeof config.certificatesResolvers !== "object" - ) { - return []; - } - return Object.keys(config.certificatesResolvers); - } catch { + let yamlStr: string | null = null; + if (serverId) { + const { MAIN_TRAEFIK_PATH } = paths(true); + const configPath = join(MAIN_TRAEFIK_PATH, "traefik.yml"); + const { stdout } = await execAsyncRemote(serverId, `cat ${configPath}`); + yamlStr = stdout || null; + } else { + yamlStr = readMainConfig(); + } + if (!yamlStr) return []; + const config = parse(yamlStr) as MainTraefikConfig; + if ( + !config?.certificatesResolvers || + typeof config.certificatesResolvers !== "object" + ) { return []; } + return Object.keys(config.certificatesResolvers); }; export const writeMainConfig = (traefikConfig: string) => {