From 37bdbf4371c323e932561d578898a1ac77e6eb8d Mon Sep 17 00:00:00 2001 From: LaunchDarklyReleaseBot Date: Fri, 25 Aug 2023 23:55:51 -0700 Subject: [PATCH] fix: wrong events path for clientSideID --- .../shared/sdk-server/src/events/EventSender.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/shared/sdk-server/src/events/EventSender.ts b/packages/shared/sdk-server/src/events/EventSender.ts index d19153929..afd7bc103 100644 --- a/packages/shared/sdk-server/src/events/EventSender.ts +++ b/packages/shared/sdk-server/src/events/EventSender.ts @@ -40,15 +40,12 @@ export default class EventSender implements subsystem.LDEventSender { ...defaultHeaders(sdkKey, config, info), }; - this.eventsUri = `${events}/bulk`; + const isClientSideID = !sdkKey.startsWith('sdk-'); + this.eventsUri = isClientSideID ? `${events}/events/bulk/${sdkKey}` : `${events}/bulk`; + this.diagnosticEventsUri = isClientSideID + ? `${events}/events/diagnostic/${sdkKey}` + : `${events}/diagnostic`; - // edge sdks use clientSideID so we use the environment endpoint - const useEnvironmentEndpoint = !sdkKey.startsWith('sdk-'); - if (useEnvironmentEndpoint) { - this.eventsUri = `${this.eventsUri}/${sdkKey}`; - } - - this.diagnosticEventsUri = `${events}/diagnostic`; this.requests = requests; this.crypto = crypto; }