From 57543abb7c876c66a632e81e2acf5b59888e1099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 3 Apr 2026 14:53:43 +0200 Subject: [PATCH] Update packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Fredrik Adelöw Signed-off-by: Fredrik Adelöw Made-with: Cursor Signed-off-by: Fredrik Adelöw Made-with: Cursor --- .../src/entrypoints/discovery/HostDiscovery.test.ts | 8 ++++++-- .../src/entrypoints/discovery/HostDiscovery.ts | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.test.ts b/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.test.ts index cdfe8a79e1..85cbaaa73b 100644 --- a/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.test.ts +++ b/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.test.ts @@ -418,7 +418,11 @@ describe('HostDiscovery', () => { const originalNodeEnv = env.NODE_ENV; afterEach(() => { - env.NODE_ENV = originalNodeEnv; + if (originalNodeEnv) { + env.NODE_ENV = originalNodeEnv; + } else { + delete env.NODE_ENV; + } }); it('warns when backend.baseUrl is a localhost URL and NODE_ENV is production', () => { @@ -436,7 +440,7 @@ describe('HostDiscovery', () => { ); expect(logger.warn).toHaveBeenCalledWith( - `backend.baseUrl is set to a localhost URL (http://localhost:7007) but NODE_ENV is 'production'. This is likely a misconfiguration — localhost URLs are not reachable by other services in a deployed environment. Prefer setting it to a routable URL that can be resolved and reached both by your app and by other plugin deployments / services.`, + `backend.baseUrl is set to a localhost URL and NODE_ENV is 'production'. This is likely a misconfiguration — localhost URLs are not reachable by other services in a deployed environment. Prefer setting it to a routable URL that can be resolved and reached both by your app and by other plugin deployments / services.`, ); }); diff --git a/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.ts b/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.ts index 23cced476e..7e25ba66c4 100644 --- a/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.ts +++ b/packages/backend-defaults/src/entrypoints/discovery/HostDiscovery.ts @@ -164,7 +164,7 @@ export class HostDiscovery implements DiscoveryService { hostname === '::'; if (isLocalhost && process.env.NODE_ENV === 'production') { options?.logger?.warn( - `backend.baseUrl is set to a localhost URL (${baseUrl}) but NODE_ENV is '${process.env.NODE_ENV}'. This is likely a misconfiguration — localhost URLs are not reachable by other services in a deployed environment. Prefer setting it to a routable URL that can be resolved and reached both by your app and by other plugin deployments / services.`, + `backend.baseUrl is set to a localhost URL and NODE_ENV is '${process.env.NODE_ENV}'. This is likely a misconfiguration — localhost URLs are not reachable by other services in a deployed environment. Prefer setting it to a routable URL that can be resolved and reached both by your app and by other plugin deployments / services.`, ); } } catch {