diff --git a/src/app/functions/server/getExperimentationId.ts b/src/app/functions/server/getExperimentationId.ts index 6e03a6efcea..5dc635aa34c 100644 --- a/src/app/functions/server/getExperimentationId.ts +++ b/src/app/functions/server/getExperimentationId.ts @@ -28,6 +28,9 @@ export function getExperimentationId( // If the user is logged in, use the Subscriber ID. const namespace = process.env.NIMBUS_UUID_NAMESPACE; if (!namespace) { + logger.error( + "NIMBUS_UUID_NAMESPACE environment variable is missing. Cannot generate experimentationId.", + ); throw new Error( "NIMBUS_UUID_NAMESPACE not set, cannot create experimentationId", ); @@ -47,6 +50,9 @@ export function getExperimentationId( ); return "guest-no-experimentation-id-set-by-monitor-middleware"; } + logger.info("Using experimentationId from header for guest user", { + experimentationId, + }); return experimentationId as ExperimentationId; } } diff --git a/src/app/functions/server/getExperiments.ts b/src/app/functions/server/getExperiments.ts index 66dc85ff271..205a036af4f 100644 --- a/src/app/functions/server/getExperiments.ts +++ b/src/app/functions/server/getExperiments.ts @@ -50,6 +50,11 @@ export async function getExperiments(params: { serverUrl.searchParams.set("nimbus_preview", "true"); } + logger.info("Sending request to Cirrus", { + serverUrl: serverUrl.toString(), + previewMode: params.previewMode, + }); + const response = await fetch(serverUrl, { headers: { "Content-Type": "application/json", @@ -65,6 +70,14 @@ export async function getExperiments(params: { }), }); + if (!response.ok) { + logger.error("Cirrus request failed", { + status: response.status, + url: serverUrl.toString(), + }); + throw new Error(`Cirrus request failed: ${response.statusText}`); + } + const json = await response.json(); let experimentData; @@ -76,7 +89,12 @@ export async function getExperiments(params: { return (experimentData as ExperimentData) ?? defaultExperimentData; } catch (ex) { - logger.error("Could not connect to Cirrus", { serverUrl, ex }); + logger.error("Could not connect to Cirrus", { + serverUrl, + ex, + flags, + params, + }); captureException(ex); return defaultExperimentData; }