From 52b5bc9504784783bfb08827dec604a2030a1e31 Mon Sep 17 00:00:00 2001 From: nicolasburtey Date: Mon, 2 Oct 2023 23:20:50 +0200 Subject: [PATCH] fix: not hanging on missing ip (#3295) Co-authored-by: Nicolas Burtey --- core/api/src/servers/graphql-admin-server.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/api/src/servers/graphql-admin-server.ts b/core/api/src/servers/graphql-admin-server.ts index 28d1aa1ee8..68465fae97 100644 --- a/core/api/src/servers/graphql-admin-server.ts +++ b/core/api/src/servers/graphql-admin-server.ts @@ -51,15 +51,17 @@ const setGqlAdminContext = async ( const logger = baseLogger const tokenPayload = req.token + // TODO: delete once migration to Oauth2 is completed const ipString = UNSECURE_IP_FROM_REQUEST_OBJECT ? req.ip : req.headers["x-real-ip"] || req.headers["x-forwarded-for"] - const ip = parseIps(ipString) + let ip = parseIps(ipString) if (!ip) { logger.error("ip missing") - return + ip = "127.0.0.1" as IpAddress // dummy ip } + // end TODO // TODO: loaders probably not needed for the admin panel const loaders = {