diff --git a/packages/session-recorder/README.md b/packages/session-recorder/README.md index 2369ab61..a480a752 100644 --- a/packages/session-recorder/README.md +++ b/packages/session-recorder/README.md @@ -33,7 +33,7 @@ import SplunkSessionRecorder from '@splunk/otel-web-session-recorder' // This must be called after initializing splunk rum SplunkSessionRecorder.init({ - beaconEndpoint: 'https://rum-ingest..signalfx.com/v1/rumreplay', + realm: '', rumAccessToken: '' }); ``` diff --git a/packages/session-recorder/src/index.ts b/packages/session-recorder/src/index.ts index fe11e98a..71d2b9c4 100644 --- a/packages/session-recorder/src/index.ts +++ b/packages/session-recorder/src/index.ts @@ -31,17 +31,17 @@ type RRWebOptions = Parameters[0]; export type SplunkRumRecorderConfig = RRWebOptions & { /** Destination for the captured data */ - beaconEndpoint: string; + beaconEndpoint?: string; /** Destination for the captured data * @deprecated Use beaconEndpoint */ - beaconUrl: string; + beaconUrl?: string; /** * The name of your organization’s realm. Automatically configures beaconUrl with correct URL */ - realm: string; + realm?: string; /** * RUM authorization token for data sending. Please make sure this is a token @@ -141,10 +141,17 @@ const SplunkRumRecorder = { console.warn('Splunk Session Recorder: Realm value ignored (beaconEndpoint has been specified)'); } } + + if (!exportUrl) { + console.error('Session recorder could not determine `exportUrl`, please ensure that `realm` or `beaconEndpoint` is specified and try again'); + return; + } + const headers = {}; if (apiToken) { headers['X-SF-Token'] = apiToken; } + if (rumAccessToken) { exportUrl += `?auth=${rumAccessToken}`; }