posthog-node 4.5.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Next
2
2
 
3
+ # 4.5.1 - 2025-02-12
4
+
5
+ ## Fixed
6
+
7
+ 1. Do not require a `distinctId` as an argument to `captureException`
8
+
3
9
  # 4.5.0 - 2025-02-06
4
10
 
5
11
  ## Added
package/lib/index.cjs.js CHANGED
@@ -7,7 +7,7 @@ var node_fs = require('node:fs');
7
7
  var node_readline = require('node:readline');
8
8
  var node_path = require('node:path');
9
9
 
10
- var version = "4.5.0";
10
+ var version = "4.5.1";
11
11
 
12
12
  var PostHogPersistedProperty;
13
13
  (function (PostHogPersistedProperty) {
@@ -2878,10 +2878,12 @@ function getLastStackFrame(arr) {
2878
2878
 
2879
2879
  const SHUTDOWN_TIMEOUT = 2000;
2880
2880
  class ErrorTracking {
2881
- static async captureException(client, error, distinctId, hint, additionalProperties) {
2881
+ static async captureException(client, error, hint, distinctId, additionalProperties) {
2882
2882
  const properties = {
2883
2883
  ...additionalProperties
2884
2884
  };
2885
+ // Given stateless nature of Node SDK we capture exceptions using personless processing when no
2886
+ // user can be determined because a distinct_id is not provided e.g. exception autocapture
2885
2887
  if (!distinctId) {
2886
2888
  properties.$process_person_profile = false;
2887
2889
  }
@@ -2907,11 +2909,7 @@ class ErrorTracking {
2907
2909
  }
2908
2910
  }
2909
2911
  onException(exception, hint) {
2910
- // Given stateless nature of Node SDK we capture exceptions using personless processing
2911
- // when no user can be determined e.g. in the case of exception autocapture
2912
- ErrorTracking.captureException(this.client, exception, uuidv7(), hint, {
2913
- $process_person_profile: false
2914
- });
2912
+ ErrorTracking.captureException(this.client, exception, hint);
2915
2913
  }
2916
2914
  async onFatalError() {
2917
2915
  await this.client.shutdown(SHUTDOWN_TIMEOUT);
@@ -3249,9 +3247,9 @@ class PostHog extends PostHogCoreStateless {
3249
3247
  }
3250
3248
  captureException(error, distinctId, additionalProperties) {
3251
3249
  const syntheticException = new Error('PostHog syntheticException');
3252
- ErrorTracking.captureException(this, error, distinctId, {
3250
+ ErrorTracking.captureException(this, error, {
3253
3251
  syntheticException
3254
- }, additionalProperties);
3252
+ }, distinctId, additionalProperties);
3255
3253
  }
3256
3254
  }
3257
3255
 
@@ -3372,7 +3370,7 @@ function setupExpressErrorHandler(_posthog, app) {
3372
3370
  };
3373
3371
  // Given stateless nature of Node SDK we capture exceptions using personless processing
3374
3372
  // when no user can be determined e.g. in the case of exception autocapture
3375
- ErrorTracking.captureException(_posthog, error, uuidv7(), hint, {
3373
+ ErrorTracking.captureException(_posthog, error, hint, uuidv7(), {
3376
3374
  $process_person_profile: false
3377
3375
  });
3378
3376
  next(error);