Contents

@posthog/convex

2.1.9

Patch Changes

2.1.8

Patch Changes

2.1.7

Patch Changes

2.1.6

Patch Changes

2.1.5

Patch Changes

  • #4800 aad7464 Thanks @marandaneto! - 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)
  • Updated dependencies [9cd8ebd, aad7464]:

2.1.4

Patch Changes

2.1.3

Patch Changes

2.1.2

Patch Changes

2.1.1

Patch Changes

2.1.0

Minor Changes

  • #4342 fa3457f Thanks @haacked! - 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)

Patch Changes

2.0.33

Patch Changes

  • #4247 3b2e68d Thanks @marandaneto! - Flush feature flag access events before remote evaluation actions return. (2026-07-27)

2.0.32

Patch Changes

  • #4061 cc01eea Thanks @turnipdabeets! - Gate the feature-flag local-evaluation refresh loop so it no longer runs on installs that don't use it. The self-rescheduling loop and its 5-minute supervisor now no-op unless POSTHOG_PERSONAL_API_KEY is set — event-only and remote-flag projects no longer incur ~3k/day skipped scheduled executions or the log churn they produced. Adds POSTHOG_DISABLE_LOCAL_EVALUATION as an explicit off-switch for projects that set a key but don't want the background poll. Behavior is unchanged when a key is configured. (2026-07-03)

2.0.31

Patch Changes

  • #4021 89d486c Thanks @richardsolomou! - Fix POSTHOG_FLAGS_POLLING_INTERVAL_SECONDS being ignored. The flag-refresh interval was read when the cron was registered, but Convex forwards component env vars only at runtime, so the value was always empty there and the cron was pinned to the 60s default. The refresh now runs as a self-rescheduling loop that reads the interval at runtime, with a supervisor cron that keeps the loop alive, so the configured interval is honoured.

    Fixes #3957. (2026-07-01)

2.0.30

Patch Changes

  • #4006 0063128 Thanks @github-actions! - Add groupIdentifyImmediate() to await the network request when identifying a group, mirroring captureImmediate/identifyImmediate/aliasImmediate. Useful in edge/serverless environments where the background queue may not flush. The Convex integration now uses it directly instead of routing $groupidentify through captureImmediate. (2026-06-30)
  • Updated dependencies [0063128]:

2.0.29

Patch Changes

  • #3886 e6d7fe2 Thanks @marandaneto! - Stop sending deprecated no-op top-level type, library, and library_version fields in event batch payloads. Use properties.$lib and properties.$lib_version for SDK metadata; legacy queued library and library_version values are used as fallbacks when the official $ properties are missing. (2026-06-18)
  • Updated dependencies [e6d7fe2]:

2.0.28

Patch Changes

2.0.27

Patch Changes

2.0.26

Patch Changes

2.0.25

Patch Changes

2.0.24

Patch Changes

2.0.23

Patch Changes

2.0.22

Patch Changes

2.0.21

Patch Changes

2.0.20

Patch Changes

2.0.19

Patch Changes

2.0.18

Patch Changes

2.0.17

Patch Changes

2.0.16

Patch Changes

2.0.15

Patch Changes

2.0.14

Patch Changes

2.0.13

Patch Changes

2.0.12

Patch Changes

2.0.11

Patch Changes

2.0.10

Patch Changes

2.0.9

Patch Changes

2.0.8

Patch Changes

2.0.7

Patch Changes

2.0.6

Patch Changes

2.0.5

Patch Changes

2.0.4

Patch Changes

2.0.3

Patch Changes

2.0.2

Patch Changes

2.0.1

Patch Changes

  • #3684 714ffa5 Thanks @richardsolomou! - Fix the refresh cron not registering when POSTHOG_PERSONAL_API_KEY is forwarded from the installing app. Convex only forwards component env vars at runtime, so the previous load-time gate saw an empty value during deploy-time module analysis and silently dropped the cron. The cron now registers unconditionally and gates at runtime.

    Fixes #3683. (2026-05-28)

  • Updated dependencies [7b84b75]:

2.0.0

Major Changes

  • #3662 4285c40 Thanks @richardsolomou! - v2 moves credentials onto the component via Convex 1.39's typed env-var config, bundles the flag-definitions refresh cron inside the component, and renames POSTHOG_API_KEY → POSTHOG_PROJECT_TOKEN.

    Breaking changes:

    • Requires Convex ^1.39.0 (peer dependency bumped).
    • POSTHOG_API_KEY env var renamed to POSTHOG_PROJECT_TOKEN, to clearly differentiate the project token (phc_…) from POSTHOG_PERSONAL_API_KEY (phx_… / phs_…). POSTHOG_PROJECT_TOKEN is now required at deploy time (Convex env validation enforces it); v1 silently no-op'd missing-token event sends at runtime.
    • apiKey, host, and personalApiKey no longer accepted on the PostHog client constructor — declare them as env vars on the component instead.
    • apiKey and host are no longer arguments to the component's actions (capture, identify, evaluateFlag, etc.). refreshFlagDefinitions no longer takes any arguments.
    • The refresh cron is now registered inside the component and only fires when POSTHOG_PERSONAL_API_KEY is set — delete any app-level convex/crons.ts that existed only to refresh PostHog flags.
    • posthog.refreshFlagDefinitions(ctx) renamed to posthog.reloadFeatureFlags(ctx) for parity with posthog-node.
    • Local-eval methods (getFeatureFlag, isFeatureEnabled, etc.) now throw when POSTHOG_PERSONAL_API_KEY isn't configured, pointing callers at the remote evaluateFlag methods. They still return undefined during the warm-up window when PAK is set but the cron hasn't fetched yet.
    • New optional POSTHOG_FLAGS_POLLING_INTERVAL_SECONDS env var lets you tune the cron cadence (default 60 seconds). Raise it on free-tier dev deployments to reduce function-call usage.

    See the migration guide in the README for the full diff. (2026-05-27)

1.0.10

Patch Changes

1.0.9

Patch Changes

1.0.8

Patch Changes

1.0.7

Patch Changes

1.0.6

Patch Changes

1.0.5

Patch Changes

1.0.4

Patch Changes

1.0.3

Patch Changes

1.0.2

Patch Changes

1.0.1

Patch Changes

1.0.0

Major Changes

  • #3622 a1a668e Thanks @richardsolomou! - Feature flags are now evaluated locally in the Convex runtime instead of via a per-call action to PostHog. Your app schedules a cron that calls posthog.refreshFlagDefinitions(ctx) on whatever interval suits you; the component fetches /flags/definitions, caches the result in a Convex table, and feature flag methods read from that cache and evaluate flags in-process. Methods work in queries (not just actions) and benefit from Convex's reactivity — a query reading a flag re-runs automatically when definitions change.

    Setup: pass the keys through new PostHog(components.posthog, { apiKey, personalApiKey, host }) in your convex/posthog.ts. Convex components run in an isolated env namespace, so the client captures the keys at construction time and forwards them to the component when refreshFlagDefinitions(ctx) is called. Add a convex/crons.ts that schedules posthog.refreshFlagDefinitions(ctx) — see the README for the exact shape.

    Two evaluation paths in this release. Pick the one that fits the flag:

    • Local (getFeatureFlag, isFeatureEnabled, getFeatureFlagPayload, getFeatureFlagResult, getAllFlags, getAllFlagsAndPayloads) — query/mutation/action context, no per-call round trip, reactive. Requires personalApiKey. Returns null/undefined when local eval can't reach a verdict (experience continuity, static cohorts, the is_not_set operator, or properties you don't pass in).
    • Remote (evaluateFlag, evaluateFlagPayload, evaluateAllFlags) — action context only. Hits PostHog's /flags endpoint directly via posthog-node's evaluateFlags. No personalApiKey needed. Handles every flag.

    Breaking changes in this major release:

    • Feature flag methods (getFeatureFlag, isFeatureEnabled, getFeatureFlagPayload, getFeatureFlagResult, getAllFlags, getAllFlagsAndPayloads) now accept any context with runQuery (queries, mutations, or actions) instead of requiring an action context.
    • Methods return undefined (or empty objects for the all-flags methods) when local evaluation can't reach a verdict. They no longer fall back to a server /flags request.
    • The sendFeatureFlagEvents option has been removed; with local evaluation there is no server-side /flags call to emit those events.
    • The component now declares a flagDefinitions table — re-deploy the component to apply the schema change.
    • The component no longer ships its own cron. Consumers schedule the refresh themselves via convex/crons.ts, which makes the polling interval explicit and gives the parent app's env vars a way to reach the action. (2026-05-19)

Patch Changes

0.2.33

Patch Changes

0.2.32

Patch Changes

0.2.31

Patch Changes

0.2.30

Patch Changes

0.2.29

Patch Changes

0.2.28

Patch Changes

0.2.27

Patch Changes

0.2.26

Patch Changes

0.2.25

Patch Changes

0.2.24

Patch Changes

0.2.23

Patch Changes

0.2.22

Patch Changes

0.2.21

Patch Changes

0.2.20

Patch Changes

0.2.19

Patch Changes

0.2.18

Patch Changes

0.2.17

Patch Changes

0.2.16

Patch Changes

0.2.15

Patch Changes

0.2.14

Patch Changes

0.2.13

Patch Changes

0.2.12

Patch Changes

0.2.11

Patch Changes

0.2.10

Patch Changes

0.2.9

Patch Changes

0.2.8

Patch Changes

0.2.7

Patch Changes

0.2.6

Patch Changes

0.2.5

Patch Changes

0.2.4

Patch Changes

0.2.3

Patch Changes

0.2.2

Patch Changes

0.2.1

Patch Changes

0.2.0

Minor Changes

Patch Changes

0.1.19

Patch Changes

0.1.18

Patch Changes

0.1.17

Patch Changes

0.1.16

Patch Changes

0.1.15

Patch Changes

0.1.14

Patch Changes

0.1.13

Patch Changes

0.1.12

Patch Changes

0.1.11

Patch Changes

0.1.10

Patch Changes

0.1.9

Patch Changes

0.1.8

Patch Changes

0.1.7

Patch Changes

0.1.6

Patch Changes

0.1.5

Patch Changes

0.1.4

Patch Changes

0.1.3

Patch Changes

0.1.2

Patch Changes

0.1.1

Patch Changes

0.1.0

Minor Changes

0.1.0

Minor Changes

Patch Changes