diff --git a/src/constants.ts b/src/constants.ts index f058ffce5..594f1503b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,6 @@ export const EVENT_TIMERS_KEY = '__timers' export const AUTOCAPTURE_DISABLED_SERVER_SIDE = '$autocapture_disabled_server_side' export const HEATMAPS_ENABLED_SERVER_SIDE = '$heatmaps_enabled_server_side' export const EXCEPTION_CAPTURE_ENABLED_SERVER_SIDE = '$exception_capture_enabled_server_side' -export const EXCEPTION_CAPTURE_ENDPOINT_SUFFIX = '$exception_capture_endpoint_suffix' export const WEB_VITALS_ENABLED_SERVER_SIDE = '$web_vitals_enabled_server_side' export const DEAD_CLICKS_ENABLED_SERVER_SIDE = '$dead_clicks_enabled_server_side' export const WEB_VITALS_ALLOWED_METRICS = '$web_vitals_allowed_metrics' diff --git a/src/posthog-core.ts b/src/posthog-core.ts index 2a87ba0f7..69f94e94e 100644 --- a/src/posthog-core.ts +++ b/src/posthog-core.ts @@ -563,7 +563,6 @@ export class PostHog { this.experiments?.afterDecideResponse(response) this.surveys?.afterDecideResponse(response) this.webVitalsAutocapture?.afterDecideResponse(response) - this.exceptions?.afterDecideResponse(response) this.exceptionObserver?.afterDecideResponse(response) this.deadClicksAutocapture?.afterDecideResponse(response) } diff --git a/src/posthog-exceptions.ts b/src/posthog-exceptions.ts index f8cc687a2..d964ecc10 100644 --- a/src/posthog-exceptions.ts +++ b/src/posthog-exceptions.ts @@ -1,41 +1,8 @@ -import { EXCEPTION_CAPTURE_ENDPOINT_SUFFIX } from './constants' import { PostHog } from './posthog-core' -import { DecideResponse, Properties } from './types' -import { isObject } from './utils/type-utils' - -// TODO: move this to /x/ as default -export const BASE_ERROR_ENDPOINT_SUFFIX = '/e/' +import { Properties } from './types' export class PostHogExceptions { - private _endpointSuffix: string - - constructor(private readonly instance: PostHog) { - // TODO: once BASE_ERROR_ENDPOINT_SUFFIX is no longer /e/ this can be removed - this._endpointSuffix = - this.instance.persistence?.props[EXCEPTION_CAPTURE_ENDPOINT_SUFFIX] || BASE_ERROR_ENDPOINT_SUFFIX - } - - get endpoint() { - // Always respect any api_host set by the client config - return this.instance.requestRouter.endpointFor('api', this._endpointSuffix) - } - - afterDecideResponse(response: DecideResponse) { - const autocaptureExceptionsResponse = response.autocaptureExceptions - - this._endpointSuffix = isObject(autocaptureExceptionsResponse) - ? autocaptureExceptionsResponse.endpoint || BASE_ERROR_ENDPOINT_SUFFIX - : BASE_ERROR_ENDPOINT_SUFFIX - - if (this.instance.persistence) { - // when we come to moving the endpoint to not /e/ - // we'll want that to persist between startup and decide response - // TODO: once BASE_ENDPOINT is no longer /e/ this can be removed - this.instance.persistence.register({ - [EXCEPTION_CAPTURE_ENDPOINT_SUFFIX]: this._endpointSuffix, - }) - } - } + constructor(private readonly instance: PostHog) {} /** * :TRICKY: Make sure we batch these requests @@ -44,7 +11,6 @@ export class PostHogExceptions { this.instance.capture('$exception', properties, { _noTruncate: true, _batchKey: 'exceptionEvent', - _url: this.endpoint, }) } }