From 54853098a7e25573c2d9fd04445a431159d2b4ae Mon Sep 17 00:00:00 2001 From: Bazyli Brzoska Date: Fri, 3 Oct 2025 19:41:42 -0700 Subject: [PATCH] fix: return an empty object if yaml file is empty --- packages/server/src/utils/traefik/middleware.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/traefik/middleware.ts b/packages/server/src/utils/traefik/middleware.ts index 4897b94ee..0340f2edb 100644 --- a/packages/server/src/utils/traefik/middleware.ts +++ b/packages/server/src/utils/traefik/middleware.ts @@ -76,7 +76,7 @@ export const loadMiddlewares = () => { throw new Error(`File not found: ${configPath}`); } const yamlStr = readFileSync(configPath, "utf8"); - const config = parse(yamlStr) as T; + const config = (parse(yamlStr) ?? {}) as T; return config; }; @@ -94,7 +94,7 @@ export const loadRemoteMiddlewares = async (serverId: string) => { console.error(`Error: ${stderr}`); throw new Error(`File not found: ${configPath}`); } - const config = parse(stdout) as FileConfig; + const config = (parse(stdout) ?? {}) as FileConfig; return config; } catch (_) { throw new Error(`File not found: ${configPath}`);