From 8cd8815bd0297c10aaacaa12f587e5ea7e435237 Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Sat, 11 May 2024 19:06:18 -0400 Subject: [PATCH] Properly ensure reflection API is never started more than once --- js/core/src/reflectionApi.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/core/src/reflectionApi.ts b/js/core/src/reflectionApi.ts index aed10708cf..6b569c1f36 100644 --- a/js/core/src/reflectionApi.ts +++ b/js/core/src/reflectionApi.ts @@ -58,6 +58,7 @@ export async function startReflectionApi(port?: number | undefined) { if (!port) { port = Number(process.env.GENKIT_REFLECTION_PORT) || 3100; } + global[GLOBAL_REFLECTION_API_PORT_KEY] = port; const api = express(); @@ -300,7 +301,6 @@ export async function startReflectionApi(port?: number | undefined) { server = api.listen(port, () => { console.log(`Reflection API running on http://localhost:${port}`); - global[GLOBAL_REFLECTION_API_PORT_KEY] = port; }); server.on('error', (error) => {