diff --git a/src/commands/configure.gateway.ts b/src/commands/configure.gateway.ts index 9b66a7b34..c83c8d2a0 100644 --- a/src/commands/configure.gateway.ts +++ b/src/commands/configure.gateway.ts @@ -177,7 +177,8 @@ export async function promptGatewayConfig( }), runtime, ); - gatewayToken = String(tokenInput).trim() || randomToken(); + const rawInput = tokenInput ? String(tokenInput).trim() : ""; + gatewayToken = rawInput || randomToken(); } if (authMode === "password") { diff --git a/src/wizard/onboarding.gateway-config.ts b/src/wizard/onboarding.gateway-config.ts index d7dceae24..b5eb00829 100644 --- a/src/wizard/onboarding.gateway-config.ts +++ b/src/wizard/onboarding.gateway-config.ts @@ -182,7 +182,9 @@ export async function configureGatewayForOnboarding( placeholder: "Needed for multi-machine or non-loopback access", initialValue: quickstartGateway.token ?? "", }); - gatewayToken = String(tokenInput).trim() || randomToken(); + // FIX: Ensure undefined becomes an empty string, not "undefined" string + const rawInput = tokenInput ? String(tokenInput).trim() : ""; + gatewayToken = rawInput || randomToken(); } }