Packages

posthog-node

6.0.5 · 19 Nov 2026MIT23.9M / weekRepositorynpmAtom feed

Your version

370 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.

  1. 5.52.5

    21 Sep 2026
    • Stop dropping long spans that end: maxSpanAgeMs now evicts spans only once maxLiveSpans is reached, so a span that runs past the age limit and then ends is exported, and its children are no longer orphaned.
      (2026-09-21)

    • Respect the definitions response's property_matching_version during local feature flag evaluation. Version 2 uses explicit boolean/string equality and per-member array matching, while missing or other versions retain service legacy matching (including empty-array truthiness). Preserve the version in Node definition caches and Convex persisted definitions, and propagate it through person, group, cohort and dependency evaluation without mixing snapshots during reloads. Existing numeric ambiguity fallback and SemVer parsing policies are unchanged.
      (2026-09-21)

  2. 5.52.4

    15 Sep 2026
    • Server-side feature flags now resolve in posthog-node and posthog-edge even when a proxy rewrites the request's User-Agent. Flags restricted to the client runtime now resolve to undefined in these SDKs, where a rewritten User-Agent previously let them through.
      (2026-09-15)

  3. 5.52.3

    15 Sep 2026
    • Capture causes and AggregateError members with relationship metadata and individual stacks, limiting output to 50 entries and 1,000 member inspections.
      (2026-09-15)

  4. 5.52.2

    14 Sep 2026
    • Fix Express exception events reporting the initial response status instead of the final HTTP status.
      (2026-09-14)

  5. 5.52.1

    11 Sep 2026
    • Child spans now share their parent's clock, so a child no longer appears to start before or end after its parent by up to a millisecond, or by more when the system clock is adjusted mid-trace.
      (2026-09-11)

  6. 5.52.0

    10 Sep 2026
    • Add experimental distributed tracing to posthog-node: startSpan, withSpan and getActiveSpan record spans against a new traces client option. A service with tracing off still forwards an inbound traceparent, including from spans nested inside the one that received it, so a distributed trace is not severed. A traceparent may be passed as the one-element array req.headersDistinct gives. A beforeSpanSend hook sees every span before it is exported and may edit or drop it, and maxAttributesPerSpan, maxEventsPerSpan, maxAttributeValueLength, maxLiveSpans and maxSpanAgeMs bound what a single span and a single process may hold.
      (2026-09-10)

    • Stop a throwing getter in metrics.resourceAttributes from breaking every metrics export — the key is recorded as [Unserializable] instead.
      (2026-09-10)

    • Honor Retry-After when the ingestion endpoint refuses a logs or metrics batch, instead of retrying on the SDK's own schedule alone. A refusal naming a longer wait extends the one being served, up to five minutes from when it started. Retry delays now carry jitter so clients refused together do not return together, and metrics backs off exponentially across consecutive failures rather than retrying on a fixed interval.
      (2026-09-10)

  7. 5.51.8

    9 Sep 2026
    • error-tracking: Collapse repeated frame cycles in parsed stack traces to reduce grouping differences caused by recursion depth, while preserving distinct throw locations
      (2026-09-09)

  8. 5.51.7

    7 Sep 2026
    • Clarify feature flag return-value terminology across SDK APIs. A false value is a conclusive off evaluation, while undefined means no evaluation is available. Remote evaluation omits globally inactive flags, whereas backend local evaluation can resolve cached inactive definitions to false.
      (2026-09-07)

  9. 5.51.6

    1 Sep 2026
    • Expose exception capture methods through the IPostHog interface.
      (2026-09-01)

  10. 5.51.5

    1 Sep 2026
    • Match local feature flag string operators, exact-value coercion, and JSON stringification with the flags service.
      (2026-09-01)

    • Change bigint attributes on logs, metrics and spans to send as an int64 rather than as a string.
      (2026-09-01)

  11. 5.51.4

    27 Aug 2026
    • Narrow the pinterest entry in the bot-detection blocklist to pinterestbot, so real users on Pinterest's in-app browser (whose UA also contains the substring pinterest) are no longer misclassified as bots and silently excluded from analytics. The crawler's other UA variant remains covered by the existing generic bot.htm entry, so no bot-detection coverage is lost.
      (2026-08-27)

    • Honor evaluationContexts during local evaluation — flags whose evaluation contexts don't overlap the configured list are no longer evaluated locally and resolve to undefined.
      (2026-08-27)

  12. 5.51.3

    27 Aug 2026
    • Treat omitted local evaluation properties as inconclusive for is_not_set.
      (2026-08-27)

  13. 5.51.2

    25 Aug 2026
    • Handle empty feature flag evaluation key scopes without running local or remote evaluation.
      (2026-08-25)

    • Share feature flag matching, hashing, variant, and payload evaluation helpers across the Node.js and Convex SDKs without changing their runtime-specific SemVer behavior.
      (2026-08-25)

  14. 5.51.1

    24 Aug 2026
    • The Node SDK now sends the raw gzip bytes as the request body instead of wrapping them in a Blob. On Node 24.16 and later, reading a Blob request body leaks a native BlobReader that is never released, so a service calling capture() and flush() once per request grew by roughly 2.3 KB of heap per event and never gave it back. This completes the work in #4423: switching to node:zlib removed the compression-time Blob reads, but the body itself was still a Blob and still got read once per request. Compression behaviour, headers and the wire format are unchanged, and the edge build keeps using CompressionStream.
      (2026-08-24)

  15. 5.51.0

    24 Aug 2026
    • Fall back to remote evaluation when a requested flag is missing from loaded local definitions. This
      changes scoped calls that previously omitted the flag without making a request. (2026-08-24)

  16. 5.50.0

    21 Aug 2026
    • FeatureFlagEvaluations.isEnabled() now accepts an optional defaultValue option, returned whenever the flag has no value (missing key, not loaded, or a failed request). A flag with a present value — including false and variant strings — always wins over defaultValue. Purely additive; omitting the option preserves the existing false-on-miss behavior.
      (2026-08-21)

  17. 5.49.4

    21 Aug 2026
    • Fix getFeatureFlagResult returning null variant instead of undefined when remotely evaluated
      (2026-08-21)

  18. 5.49.3

    21 Aug 2026
    • Fix logs and metrics being silently dropped when an attribute holds a very large integer, a function, a symbol, a sparse array, or a truncated emoji.
      Cap log and metric attributes at 20 levels of nesting, 1,000 entries per object and 10,000 values in total, marking anything beyond as [Truncated].
      Type OtlpAnyValue.intValue as string | number — code reading that field must handle both. (2026-08-21)

  19. 5.49.2

    20 Aug 2026
    • Removed

      Drop events when a before-send hook throws instead of sending the unmodified event.
      (2026-08-20)

  20. 5.49.1

    14 Aug 2026
    • Normalize capture timestamp overrides to equivalent UTC ISO strings in the browser and Node.js SDKs and shared core.
      (2026-08-14)

  21. 5.49.0

    13 Aug 2026
    • Public beta captureAi() / captureAiImmediate(): AI events on a dedicated isolated endpoint with the event UUID returned. New enableFullAiCapture option replaces the internal _useAiLane / _enableMultimodalCapture; wrappers route through the AI endpoint and skip redaction/truncation when set (privacy mode still wins).
      (2026-08-13)

  22. 5.48.2

    12 Aug 2026
    • Log shutdown timeouts without rejecting, and correct the Node.js shutdown() return type to Promise<void>.
      (2026-08-12)

  23. 5.48.1

    6 Aug 2026
    • Enforce configured request timeouts while consuming Capture V1 response bodies.
      (2026-08-06)

    • Use Node's zlib gzip implementation for Node SDK payloads to avoid sustained memory growth from frequent Web Streams compression.
      (2026-08-06)

  24. 5.48.0

    5 Aug 2026
    • Support the starts_with, not_starts_with, ends_with, and not_ends_with property filter operators in feature flag local evaluation. Matching is case-insensitive and mirrors icontains, so flags using these operators no longer fall back to remote evaluation.
      (2026-08-05)

  25. 5.47.11

    5 Aug 2026
    • Keep request timeouts active through response body consumption and clarify eventual event UUID deduplication semantics.
      (2026-08-05)

  26. 5.47.10

    4 Aug 2026
    • Keep $referring_domain and canonical utm_*/campaign parameters on minimal $feature_flag_called events. Previously the minimal allowlist stripped every campaign parameter, so a flag-called event landing first in a session could set the session's UTM attribution and channel type to NULL in web analytics.
      (2026-08-04)

  27. 5.47.9

    4 Aug 2026
    • Fix enableExceptionAutocapture suppressing Node's default crash on unhandled promise rejections; fatal rejections in strict or warn-with-error-code mode and rejections handled by another unhandledRejection listener are no longer captured.
      (2026-08-04)

  28. 5.47.8

    4 Aug 2026
    • Schedule local feature flag polls after each request settles.
      (2026-08-04)

  29. 5.47.7

    3 Aug 2026
    • Bound stack source context reads and skip non-regular or oversized files.
      (2026-08-03)

  30. 5.47.6

    3 Aug 2026
    • Clear completed lifecycle timeout handles so successful shutdowns do not leave timers running.
      (2026-08-03)

  31. 5.47.5

    3 Aug 2026
    • personProperties and groupProperties on the feature flag methods are no longer typed as Record<string, string>, so numeric and boolean values type-check without a cast. Local evaluation already handled them — matchProperty takes Record<string, any> and compares numerically for gt/gte/lt/lte — only the public types disagreed. These now use the shared Properties type (personProperties?: Properties, groupProperties?: Record<string, Properties>), matching setPersonPropertiesForFlags/setGroupPropertiesForFlags so the any can be narrowed later. Types only, no runtime change.
      (2026-08-03)

  32. 5.47.4

    3 Aug 2026
    • Preserve events added to a full queue while an earlier batch is being flushed.
      (2026-08-03)

  33. 5.47.3

    31 Jul 2026
    • Apply the feature flag definition request timeout while consuming the response body.
      (2026-07-31)

    • Keep the feature flag definition request timeout active until the request settles.
      (2026-07-31)

  34. 5.47.2

    31 Jul 2026
    • Fix identify() leaving a user anonymous when the supplied ID already matches the persisted distinct ID (for example after a non-identified bootstrap seeded the same ID). The user is now marked identified and a person-processed $set event is captured. Ports the same fix from posthog-js (browser) to the shared core used by React Native, Node, and posthog-js-lite.
      (2026-07-31)

  35. 5.47.1

    31 Jul 2026
    • Isolate NestJS request context per Observable subscription.
      (2026-07-31)

  36. 5.47.0

    30 Jul 2026
    • Emit the release id that posthog-cli injects into your bundle as $release_id on $exception events, so PostHog can attach exceptions to a release without joining through symbol sets. Adds getInjectedReleaseId() to @posthog/core. The property is only attached when an injected release id can be read.
      (2026-07-30)

  37. 5.46.1

    23 Jul 2026
    • Normalize V8 Promise combinator stack frames so input indexes are not treated as source filenames.
      (2026-07-23)

  38. 5.46.0

    20 Jul 2026
    • Send minimal $feature_flag_called events when the server enables it

      When the v2 /flags response carries minimalFlagCalledEvents: true (or, for posthog-node local evaluation, the flag-definitions payload carries minimal_flag_called_events: true) and the evaluated flag is not linked to an experiment ($feature_flag_has_experiment === false), $feature_flag_called events are rebuilt from a strict allowlist of flag-evaluation, processing-control, and SDK-identity properties. Super properties, $set/$set_once, the $feature/<key> enumeration, $active_feature_flags, and the context envelope are stripped. Any missing signal (no gate on the response, bootstrapped or locally injected flags, has_experiment unknown) falls back to the full event, and experiment-linked flags always send the full envelope. The gate is stored alongside the cached flags (posthog-js persistence, posthog-node poller state) and is server-controlled, with no SDK-side configuration. before_send runs after the filter and may re-add stripped properties. (2026-07-20)

  39. 5.45.2

    16 Jul 2026
    • Avoid Next.js Edge runtime warnings for native compression and fatal error handling.
      (2026-07-16)

  40. 5.45.1

    16 Jul 2026
    • Fix the default Node.js event flush interval at 5 seconds.
      (2026-07-16)

  41. 5.45.0

    16 Jul 2026
    • Add $feature_flag_has_experiment to $feature_flag_called events

      $feature_flag_called events now carry a $feature_flag_has_experiment boolean sourced from the server's has_experiment flag metadata (the /flags?v=2 response for remote evaluation, the /api/feature_flag/local_evaluation definitions for posthog-node local evaluation). The property is only sent when the server explicitly reports has_experiment; it is omitted entirely when the value is unknown (older servers, missing metadata, bootstrapped or locally injected flags). (2026-07-16)

  42. 5.44.0

    15 Jul 2026
    • Raise the default maxQueueSize from 1000 to 10000. Backend workloads are more likely to burst-enqueue events synchronously ahead of a flush than browser/mobile clients, so the previous default risked silently dropping events under bursty load. An explicit maxQueueSize option still overrides this default.
      (2026-07-15)

  43. 5.43.0

    15 Jul 2026
    • Add the posthog.metrics API (count, gauge, histogram) to posthog-node — alpha

      Backend services can now record metrics through the same statsd-style pre-aggregating client the browser SDK ships, with no OpenTelemetry setup:

      const client = new PostHog('phc_...', { metrics: { serviceName: 'billing-worker' } })
      client.metrics.count('invoices.processed', 1, { attributes: { plan: 'pro' } })
      client.metrics.gauge('queue.depth', 42)
      client.metrics.histogram('job.duration', 187, { unit: 'ms' })

      Samples aggregate in memory and flush as OTLP/JSON to /i/v1/metrics (one data point per series per window). Pending metrics are flushed on shutdown(). Core gains _sendMetricsBatch on PostHogCoreStateless (same outcome contract as _sendLogsBatch) and a shared resolveMetricsConfig, so any core-based SDK can host PostHogMetrics. (2026-07-15)

  44. 5.42.0

    14 Jul 2026
    • Expose the error tracking rate-limiter config via the new exceptionRateLimiterRefillRate and exceptionRateLimiterBucketSize options. Burst protection is scoped per exception type (each distinct $exception type gets its own token bucket, with no aggregate cap across types), so these let customers with high-cardinality exception types tune the per-type allowance.
      (2026-07-14)

  45. 5.41.0

    11 Jul 2026
    • Add opt-in Capture V1 support. Set the POSTHOG_CAPTURE_MODE=v1 environment variable to submit analytics events to the Capture V1 endpoint (/i/v1/analytics/events) instead of the legacy /batch/ endpoint, on both the batched and immediate send paths. The default remains v0, so existing behavior is unchanged unless you opt in. Opt-in is env-var-only during the transition (no public option), so nothing on the API surface has to be removed when v1 later becomes the default.

      Capture V1 uses Bearer auth, lifts legacy $-sentinel properties into a typed options object, and does per-event partial retry with exponential backoff clamped against Retry-After. Dropped and undelivered events are surfaced on the client error channel as a CaptureV1Error. $ai_* events continue to use the legacy submitter for now, regardless of the capture mode.

      In v1 mode, $ai_* events are routed to an isolated in-memory queue and flushed independently of the Capture V1 queue, so the two transports never share a batch and a failure on one cannot re-send events already accepted on the other. Each queue keeps its own retry/durability semantics: the legacy queue re-queues on network failure (retrying on later flushes), while the V1 queue exhausts the sender's own attempt budget per cycle and then surfaces the failure rather than re-queuing. (2026-07-11)

  46. 5.40.0

    7 Jul 2026
    • Add secretKey config as the canonical alias for the deprecated personalApiKey (accepts a Personal API Key or Project Secret API Key).
      (2026-07-07)

  47. 5.39.4

    2 Jul 2026
    • Stop duplicating distinct_id inside /flags person properties.
      (2026-07-02)

  48. 5.39.3

    2 Jul 2026
    • Retry /flags requests that receive HTTP 502 or 504 responses across SDKs that use the shared core flags client.
      (2026-07-02)

  49. 5.39.2

    1 Jul 2026
    • Make Node flush() wait for pending asynchronous SDK work before draining the event queue, so events produced by helpers like captureException() are not missed. Pending work rejections no longer prevent queued events from flushing.
      (2026-07-01)

  50. 5.39.1

    30 Jun 2026
    • Call before_send for identify, group identify, and alias events.
      (2026-06-30)

    • Safely serialize event batches with circular property references instead of crashing during flush.
      (2026-06-30)

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.