diff --git a/flagship/dist-deno/src/decision/DecisionManager.ts b/flagship/dist-deno/src/decision/DecisionManager.ts index 69e49f04..710d9ee8 100644 --- a/flagship/dist-deno/src/decision/DecisionManager.ts +++ b/flagship/dist-deno/src/decision/DecisionManager.ts @@ -176,7 +176,11 @@ export abstract class DecisionManager implements IDecisionManager { visitor_consent: visitor.hasConsented }; - const url = `${this.config.decisionApiUrl || BASE_API_URL}${this.config.envId}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings`; + // When using custom decisionApiUrl, assume it already includes the full path (e.g., /v2/campaigns) + // When using default BASE_API_URL, include envId in path for cloud compatibility + const url = this.config.decisionApiUrl + ? `${this.config.decisionApiUrl}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings` + : `${BASE_API_URL}${this.config.envId}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings`; const now = Date.now(); try { diff --git a/flagship/src/decision/DecisionManager.ts b/flagship/src/decision/DecisionManager.ts index f4cad871..52a5c98d 100644 --- a/flagship/src/decision/DecisionManager.ts +++ b/flagship/src/decision/DecisionManager.ts @@ -176,7 +176,11 @@ export abstract class DecisionManager implements IDecisionManager { visitor_consent: visitor.hasConsented }; - const url = `${this.config.decisionApiUrl || BASE_API_URL}${this.config.envId}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings`; + // When using custom decisionApiUrl, assume it already includes the full path (e.g., /v2/campaigns) + // When using default BASE_API_URL, include envId in path for cloud compatibility + const url = this.config.decisionApiUrl + ? `${this.config.decisionApiUrl}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings` + : `${BASE_API_URL}${this.config.envId}${URL_CAMPAIGNS}?${EXPOSE_ALL_KEYS}=true&extras[]=accountSettings`; const now = Date.now(); try {