Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(sfdc): send langfuseDataRegion on updateOrg (#14527)

Steffen Schmitze37c7a4af07c
diff --git a/web/src/__tests__/server/unit/sfdc-sync.servertest.ts b/web/src/__tests__/server/unit/sfdc-sync.servertest.ts
index 27a365107b..48e15b1fdd 100644
--- a/web/src/__tests__/server/unit/sfdc-sync.servertest.ts
+++ b/web/src/__tests__/server/unit/sfdc-sync.servertest.ts
@@ -295,6 +295,8 @@ describe("SfdcService.upsertOrg", () => {
userId: "user-1",
role: "ADMIN",
+ // Cloud region the org lives in, sourced from NEXT_PUBLIC_LANGFUSE_CLOUD_REGION.
+ langfuseDataRegion: "STAGING",
// Mulesoft's updateOrg flow 500s when the CH service counts are
// missing (null > 0 comparison in DataWeave) — must always be sent.
numServicesAws: 0,
@@ -303,6 +305,20 @@ describe("SfdcService.upsertOrg", () => {
});
});
+ it("sends langfuseDataRegion from NEXT_PUBLIC_LANGFUSE_CLOUD_REGION", async () => {
+ envMock.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION = "EU";
+ fetchMock.mockResolvedValueOnce(emptyOkResponse());
+ await SfdcService.tryCreate()!.upsertOrg({
+ orgId: "org-1",
+ orgName: "Org One",
+ userId: "user-1",
+ email: "[email protected]",
+ role: "OWNER",
+ });
+ const body = JSON.parse(fetchMock.mock.calls[0][1].body as string);
+ expect(body.langfuseDataRegion).toBe("EU");
+ });
+
it("persists sfdcOrgId on 2xx with id in response", async () => {
fetchMock.mockResolvedValueOnce(okJsonResponse({ sfdcOrgId: "sfdc-o-9" }));
await SfdcService.tryCreate()!.upsertOrg({
diff --git a/web/src/ee/features/sfdc-sync/server/sfdcService.ts b/web/src/ee/features/sfdc-sync/server/sfdcService.ts
index 186a998969..f2e636d59e 100644
--- a/web/src/ee/features/sfdc-sync/server/sfdcService.ts
+++ b/web/src/ee/features/sfdc-sync/server/sfdcService.ts
@@ -122,6 +122,7 @@ interface SfdcConfig {
userUrl: string;
orgUrl: string;
basicAuthHeader: string;
+ dataRegion: string;
}
export class SfdcService {
@@ -146,6 +147,7 @@ export class SfdcService {
userUrl: env.MULESOFT_SFDC_USER_URL,
orgUrl: env.MULESOFT_SFDC_ORG_URL,
basicAuthHeader,
+ dataRegion: env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION,
});
}
@@ -207,6 +209,7 @@ export class SfdcService {
payload: {
isLangfuse: true,
type: "updateOrg" as const,
+ langfuseDataRegion: this.config.dataRegion,
// The Mulesoft updateOrg flow runs `numServices* > 0` comparisons
// and 500s on null — always send 0
numServicesAws: 0,