# What changed in posthog-node

> 185 changes in posthog-node 5 from its official release notes, upgrade guides and advisories: 15 breaking, 10 deprecations, 58 new APIs and options. Each one cited. Sources checked 2026-10-18. HTML: https://unstale.sh/npm/posthog-node/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## posthog-node 5

### Breaking changes

- Returns a snapshot, so changing individual keys no longer affects deduplication; the cache evicts only the least recently used distinct IDs instead of clearing entirely. (5.55.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.55.1)
- Server-side feature flags now resolve in posthog-node even when a proxy rewrites the request's User-Agent; flags restricted to the client runtime resolve to undefined. (5.52.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.4)
- Bigint attributes on logs, metrics, and spans are now sent as int64 rather than as strings. (5.51.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.5)
- Local evaluation now honors evaluationContexts; flags whose evaluation contexts do not overlap the configured list resolve to undefined instead of being evaluated locally. (5.51.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.4)
- Events are dropped when the before-send hook throws, rather than being sent unmodified. (5.49.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.2)
- Replaces the internal AI capture options; when set, wrappers route through the AI endpoint and skip redaction and truncation, while privacy mode still takes precedence. (5.49.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.0)
- Shutdown timeouts are logged without rejecting, so callers do not receive a rejection for a timeout. (5.48.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.2)
- No longer suppresses 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. (5.47.9) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.9)
- Semver values with leading zeros are rejected in both flag and override values; invalid inputs surface as InconclusiveMatchError and do not match targeting conditions. (5.34.10) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.10)
- An inactive flag now short-circuits to false even when ensure_experience_continuity is true, instead of throwing InconclusiveMatchError and resolving to undefined. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- Cohort property groups containing a flag-type property now mark cohort evaluation inconclusive, so the flag returns undefined instead of a wrong definitive answer. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- is_set now returns true when a property key is present, even if its value is null or undefined. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- Use evaluationContexts in posthog.init to specify evaluation contexts instead of deployment environments. (5.23.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.23.0)
- The minimum supported Node.js version is now ^20.20.0 || >=22.22.0 due to an async-hooks DoS vulnerability. (5.22.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.22.0)
- Contexts inherit by default, changing how context values are passed to child contexts. (5.17.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.17.0)

### Deprecations

- The Node SDK Sentry integration is deprecated; users are directed to PostHog Error Tracking for Node. (5.38.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.3)
- Imports from posthog-node/experimental are deprecated. (5.35.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.35.0)
- The sendFeatureFlags option is deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Deprecated; it continues to work but logs a deduped warning the first time it is used, and removal is planned for the next major version. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Manual capture('$exception') now emits a warning. (5.24.17) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.24.17)
- The posthog.init option is deprecated in favor of evaluationContexts; it continues to work and logs a deprecation warning. (5.23.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.23.0)
- A warning is emitted when local evaluation encounters flags with experience continuity enabled, explaining that they cause server requests on every evaluation. (5.21.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.21.0)
- The package is deprecated. (5.14.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.14.0)

### New APIs and options

- Local feature flag evaluation can use a shared definition cache without a secret or personal API key. (5.56.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.56.2)
- Feature flag evaluation reasons are exposed and preserved in OpenFeature resolution metadata. (5.54.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.54.0)
- Adds an API to read a feature flag's evaluation runtime. (5.53.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.53.0)
- Adds an API to get feature flag keys by evaluation runtime. (5.53.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.53.0)
- Adds a hook that sees every span before export and may edit or drop it. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Adds experimental distributed tracing that records spans using the traces client option. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Bounds how many attributes a single span may hold. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Bounds attribute value length for spans. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Bounds how many events a single span may hold. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Bounds how many spans a single process may hold. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Bounds how long a span may be held by a single process. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Adds experimental distributed tracing that records spans using the traces client option. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Adds a client option for recording experimental distributed tracing spans. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Adds experimental distributed tracing that records spans using the traces client option. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Exception capture methods are now exposed through the IPostHog interface. (5.51.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.6)
- Accepts an optional defaultValue returned when a flag has no value; present flag values still take precedence, and omitting the option preserves false-on-miss behavior. (5.50.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.50.0)
- Public beta API for sending AI events to a dedicated isolated endpoint and receiving the event UUID. (5.49.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.0)
- Public beta API for sending AI events to a dedicated isolated endpoint and receiving the event UUID. (5.49.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.0)
- The property is added to $feature_flag_called events when the server explicitly reports has_experiment; it is omitted when the value is unknown. (5.45.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.45.0)
- Adds an alpha metrics API for recording count, gauge, and histogram metrics from backend services, with in-memory aggregation and OTLP/JSON flushing. (5.43.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.43.0)
- Exposes the error tracking rate-limiter bucket size so customers with high-cardinality exception types can tune the per-type allowance. (5.42.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.42.0)
- Exposes the error tracking rate-limiter refill rate so customers with high-cardinality exception types can tune the per-type allowance. (5.42.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.42.0)
- Dropped and undelivered Capture V1 events are surfaced on the client error channel as CaptureV1Error. (5.41.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.41.0)
- Set POSTHOG_CAPTURE_MODE=v1 to send analytics events to Capture V1 instead of the legacy /batch/ endpoint. Capture V1 uses Bearer auth and per-event partial retries; the default remains v0. (5.41.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.41.0)
- Adds secretKey as the canonical alias for personalApiKey; it accepts a Personal API Key or Project Secret API Key. (5.40.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.40.0)
- Adds groupIdentifyImmediate() to await the network request when identifying a group, useful in edge/serverless environments where the background queue may not flush. (5.39.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.0)
- Adds a helper to manage person properties from the Node.js SDK. (5.38.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.0)
- Adds a helper to manage person properties from the Node.js SDK. (5.38.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.0)
- Local evaluation now supports the early_exit condition option, stopping with false when matching property filters are excluded by the rollout percentage instead of falling through to later groups. (5.37.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.37.0)
- Adds configurable isServer behavior, defaulting to true, to set the $is_server event property; set it to false for client or CLI use so the device OS is attributed normally. (5.36.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.36.0)
- Exposes UUID and cookie helpers from posthog-node so users can manage distinct_id outside the browser SDK. (5.34.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.0)
- Accepts a flags snapshot so the same flag evaluations used for branching can enrich a captured event. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Accepts a flags argument so $exception events carry the same flag context as the rest of the request's events. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Accepts a flags argument so $exception events carry the same flag context as the rest of the request's events. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Evaluates feature flags in one /flags request and returns a FeatureFlagEvaluations snapshot with methods for branching and filtering flags attached to captured events. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Pass flagKeys to scope the underlying /flags request to selected flags. (5.33.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.0)
- Adds Express and NestJS request context support for PostHog tracing headers. (5.31.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.31.0)
- Adds a NestJS integration with an interceptor for context propagation. (5.28.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.28.0)
- Local feature flag evaluation now supports semver_caret for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_eq for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_gt for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_gte for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_lt for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_lte for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_neq for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_tilde for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Local feature flag evaluation now supports semver_wildcard for semantic version comparisons. (5.27.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.1)
- Accepts a waitUntil method for serverless environments. (5.27.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.27.0)
- Adds enterContext() to attach a context to the current async execution context. (5.26.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.26.0)
- Adds an /edge subpath export for use with non-standard edge runtimes. (5.24.13) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.24.13)
- Adds a method to retrieve a feature flag value and payload in a single API call. (5.21.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.21.2)
- Set strictLocalEvaluation: true at client init to prevent server fallback for flag evaluations; flags that cannot be evaluated locally return undefined. (5.21.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.21.0)
- Adds the overrideFeatureFlags() method for local testing and development. (5.19.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.19.0)
- Adds $feature_flag_error to $feature_flag_called events to track flag evaluation failures. (5.18.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.24.0), [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.18.0)
- Context support was added. (5.15.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.15.0)
- Adds a client configuration option for the flag definition cache provider. (5.12.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.12.0)
- Adds the FlagDefinitionCacheProvider interface for providing a flag definition cache. (5.12.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.12.0)
- Enables tracking bot traffic as $bot_pageview events when enabled. (5.11.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.11.0)

### Performance

- Node SDK payloads use Node's zlib gzip implementation to avoid sustained memory growth from frequent Web Streams compression. (5.48.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.1)
- Local evaluation polling sends the latest etag in an If-None-Match header to reduce bandwidth when no flags have changed. (5.17.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.17.2)
- Cache initialization performance was improved. (5.15.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.15.0)

### Behavior and default changes

- Captured exceptions are linked to active OpenTelemetry traces when the API is available. (5.56.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.56.1)
- Metrics recorded inside sampled spans now have trace exemplars attached. (5.56.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.56.0)
- Setting featureFlagsPollingInterval to null disables automatic local flag polling while retaining initialization and manual refresh. (5.55.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.55.0)
- Feature flag cache payloads now support snake_case while preserving compatibility with camelCase providers and cached data. (5.54.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.54.1)
- Error capture now includes causes and AggregateError members with relationship metadata and individual stacks, limited to 50 entries and 1,000 member inspections. (5.52.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.3)
- Batches over 10 MiB or too large to serialize are stopped before making a request. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Logs and metrics retries honor Retry-After, extend waits up to five minutes, add jitter, and metrics back off exponentially across consecutive failures. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- A false value means a conclusive off evaluation, while undefined means no evaluation is available. Remote evaluation omits globally inactive flags; backend local evaluation can resolve cached inactive definitions to false. (5.51.7) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.7)
- When a requested flag is missing from loaded local definitions, scoped calls now fall back to remote evaluation instead of omitting the flag without making a request. (5.51.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.0)
- Feature flag local evaluation now supports ends_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation. (5.48.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.0)
- Feature flag local evaluation now supports not_ends_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation. (5.48.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.0)
- Feature flag local evaluation now supports not_starts_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation. (5.48.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.0)
- Feature flag local evaluation now supports starts_with property filters, with case-insensitive matching, so matching flags no longer fall back to remote evaluation. (5.48.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.0)
- Local feature flag polls are scheduled after each request settles. (5.47.8) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.8)
- Feature flag methods now accept numeric and boolean group property values through the shared Properties type, matching local evaluation. (5.47.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.5)
- Feature flag methods now accept numeric and boolean person property values through the shared Properties type, matching local evaluation. (5.47.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.5)
- Exception events include the injected release id as $release_id when one can be read, allowing PostHog to attach exceptions to a release without joining through symbol sets. (5.47.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.0)
- When the server enables minimal events, evaluations of flags not linked to experiments emit events rebuilt from an allowlist; missing signals and experiment-linked flags retain the full event. (5.46.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.46.0)
- The default maxQueueSize increases from 1000 to 10000 to reduce silent event drops during bursty workloads; an explicit option still overrides the default. (5.44.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.44.0)
- Pending metrics are flushed when shutdown() is called. (5.43.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.43.0)
- In v1 mode, $ai_* events continue to use the legacy submitter and an isolated in-memory queue, flushed independently so the transports do not share batches. (5.41.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.41.0)
- before_send is now called for identify, group identify, and alias events. (5.39.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.1)
- Feature flag requests are retried only after transient network errors. The retry count defaults to 1 and can be set to 0 to disable retries. (5.38.7) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.7)
- Batch payloads no longer send the top-level type, library, and library_version fields. SDK metadata uses properties.$lib and properties.$lib_version, falling back to legacy queued values when those properties are missing. (5.38.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.1)
- Feature flag definition cache provider types are now available from the main posthog-node export. (5.35.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.35.0)
- Local evaluation now supports mixed targeting. (5.32.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.32.0)
- Frames are sent with relative file paths. (5.30.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.30.0)
- Sends $device_id as a top-level field in /flags requests, enabling device-based bucketing during remote evaluation. (5.29.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.29.2)
- The config query parameter is omitted by default so requests retrieve only the necessary data. (5.28.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.28.2)
- Locally evaluated flags now include timing information in $feature_flag_called events, helping debug cache TTL and timing issues. (5.26.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.26.1)
- A context-sensitive override no longer requires distinctId as a parameter and instead reads it from the current context. (5.26.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.26.0)
- A context-sensitive override no longer requires distinctId as a parameter and instead reads it from the current context. (5.26.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.26.0)
- A context-sensitive override no longer requires distinctId as a parameter and instead reads it from the current context. (5.26.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.26.0)
- Traces now track the exception_id, helping correlate traces with exceptions. (5.20.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.20.0)
- Exceptions now track the LLM trace_id, helping correlate exceptions with traces. (5.20.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.20.0)
- Adds $feature_flag_evaluated_at properties to $feature_flag_called events. (5.16.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.16.0)
- The Express error handler now forwards session and distinct id. (5.14.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.14.1)

### Fixes and other changes

- Types now accept non-null events while still allowing null returns to drop events. (5.55.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.55.3)
- Local feature flag evaluation now honors filters.holdout before release conditions, assigning held-out users the holdout variant and matching server evaluation. (5.52.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.6)
- Spans that run past the age limit and then end are exported; maxSpanAgeMs now evicts spans only once maxLiveSpans is reached, preventing their children from being orphaned. (5.52.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.5)
- Local feature flag evaluation respects the definitions response version: version 2 uses explicit boolean/string equality and per-member array matching, while missing or other versions retain service legacy matching. (5.52.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.5)
- Express exception events now report the final HTTP status instead of the initial response status. (5.52.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.2)
- Child spans now share their parent's clock, preventing them from appearing to start before or end after their parent, including when the system clock changes mid-trace. (5.52.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.1)
- A throwing getter no longer breaks every metrics export; its key is recorded as `[Unserializable]` instead. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Logs and metrics always send service.name and telemetry.sdk.* even when a resourceAttributes value is too large to encode in full. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Logs and metrics always send service.name and telemetry.sdk.* even when a resourceAttributes value is too large to encode in full. (5.52.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.52.0)
- Parsed stack traces now collapse repeated frame cycles to reduce grouping differences caused by recursion depth while preserving distinct throw locations. (5.51.8) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.8)
- Local feature flag evaluation now matches the flags service for string operators, exact-value coercion, and JSON stringification. (5.51.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.5)
- Narrows the bot-detection blocklist entry to pinterestbot so users of Pinterest's in-app browser are no longer misclassified as bots and excluded from analytics. (5.51.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.4)
- Omitted local evaluation properties are treated as inconclusive for is_not_set. (5.51.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.3)
- Empty feature flag evaluation key scopes are handled without running local or remote evaluation. (5.51.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.2)
- The Node SDK sends raw gzip bytes instead of wrapping them in a Blob, avoiding a native BlobReader leak on Node 24.16 and later. Compression behavior, headers, and wire format are unchanged. (5.51.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.51.1)
- Fixes remotely evaluated results to return an undefined variant instead of null. (5.49.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.4)
- Logs and metrics are no longer silently dropped for attributes containing certain unsupported or unusually large values; attributes are capped and excess content is marked as [Truncated]. (5.49.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.3)
- OtlpAnyValue.intValue is typed as string | number, so code reading the field must handle both types. (5.49.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.3)
- Capture timestamp overrides are normalized to equivalent UTC ISO strings in the browser and Node.js SDKs and shared core. (5.49.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.49.1)
- The Node.js shutdown() return type is corrected to Promise<void>. (5.48.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.2)
- Configured request timeouts are now enforced while consuming Capture V1 response bodies. (5.48.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.48.1)
- Request timeouts remain active while the response body is consumed. (5.47.11) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.11)
- Minimal events retain $referring_domain and canonical utm_*/campaign parameters, preventing a flag-called event from setting session attribution and channel type to NULL. (5.47.10) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.10)
- Bounds stack source context reads and skips non-regular or oversized files. (5.47.7) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.7)
- Completed lifecycle timeout handles are cleared so successful shutdowns do not leave timers running. (5.47.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.6)
- Events added to a full queue are preserved while an earlier batch is being flushed. (5.47.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.4)
- The timeout remains active until the request settles, including while the response body is consumed. (5.47.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.3)
- When the supplied ID matches the persisted distinct ID, identify() now marks the user identified and captures a person-processed $set event. (5.47.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.2)
- NestJS request context is isolated per Observable subscription. (5.47.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.47.1)
- Normalizes V8 Promise combinator stack frames so input indexes are not treated as source filenames. (5.46.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.46.1)
- Avoids Edge runtime warnings related to native compression and fatal error handling. (5.45.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.45.2)
- The default Node.js event flush interval is fixed at 5 seconds. (5.45.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.45.1)
- Stops duplicating distinct_id inside /flags person properties. (5.39.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.4)
- Requests to /flags that receive HTTP 502 or 504 responses are retried across SDKs using the shared core flags client. (5.39.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.3)
- Node flush() waits for pending asynchronous SDK work before draining the event queue, so helper-produced events are not missed; pending work rejections no longer prevent queued events from flushing. (5.39.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.2)
- Event batches with circular property references are safely serialized instead of crashing during flush. (5.39.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.39.1)
- Local evaluation now applies the in/not_in operator to cohort membership, fixing inverted cohort-exclusion flags. (5.38.8) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.8)
- Only stamp $groups from the top-level groups when present. (5.38.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.6)
- Feature flag called events are deduplicated per returned flag value. (5.38.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.5)
- Respect disable_capture_url_hashes when capturing Express and NestJS request URLs. (5.38.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.4)
- Custom event UUID overrides are validated, and a new UUID is generated when an override is invalid. (5.38.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.38.2)
- Initialization paths with missing or blank PostHog project tokens now disable or no-op instead of throwing or sending requests. (5.35.9) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.35.9)
- captureException was unified in posthog core. (5.35.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.35.6)
- The deduplication key now includes group context, so events fire independently per group combination. (5.35.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.35.2)
- identifyImmediate now awaits the underlying network request, preventing the $identify event from being dropped when short-lived runtimes exit after await. (5.34.8) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.8)
- Local gt/gte/lt/lte evaluation now compares numerically when both sides parse as finite numbers, avoiding incorrect lexicographic comparisons. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- Local evaluation resolves is_not_set as true when the property key is absent and false when present, rather than throwing InconclusiveMatchError. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- Flag-level condition properties with negation: true are now inverted, matching the existing cohort-path behavior. (5.34.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.34.6)
- The fetch response body is consumed to prevent Cloudflare Workers runtime warnings. (5.33.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.33.2)
- Local evaluation polling now uses /flags/definitions instead of /api/feature_flag/local_evaluation. (5.29.4) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.29.4)
- Surrounding whitespace is trimmed from user-provided API keys, personal API keys, and host config values before they are used. (5.29.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.29.3)
- Local flag evaluation cache now preserves $set_once semantics. (5.29.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.29.0)
- captureException now uses distinctId from request context. (5.28.6) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.28.6)
- Fixed the return value of captureExceptionImmediate. (5.28.3) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.28.3)
- Client shutdown now awaits the feature flags poller stopping. (5.28.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.28.2)
- Super properties added with register now work. (5.25.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.25.0)
- In Node, before_send now infers its type as EventMessage or null instead of any. (5.24.5) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.24.5)
- getFeatureFlag() respects exponential backoff for HTTP 401, 403, and 429 responses. (5.18.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.18.1)
- Fixes the frame platform property for $exception events. (5.13.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.13.0)
- fetch is called without a bound context, preventing issues in edge runtimes such as Cloudflare. (5.13.0) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.13.0)
- Fixes a crash when calling getFeatureFlagPayloads for a flag that depends on a static cohort. (5.10.2) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.10.2)
- Fixes server fallback when a static cohort condition is followed by a matching condition. (5.10.1) — [release notes](https://github.com/PostHog/posthog-js/releases/tag/posthog-node%405.10.1)
