2.0.0
Major Changes
-
#3662
4285c40Thanks @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 renamesPOSTHOG_API_KEY→POSTHOG_PROJECT_TOKEN.Breaking changes:
- Requires Convex
^1.39.0(peer dependency bumped). POSTHOG_API_KEYenv var renamed toPOSTHOG_PROJECT_TOKEN, to clearly differentiate the project token (phc_…) fromPOSTHOG_PERSONAL_API_KEY(phx_…/phs_…).POSTHOG_PROJECT_TOKENis now required at deploy time (Convex env validation enforces it); v1 silently no-op'd missing-token event sends at runtime.apiKey,host, andpersonalApiKeyno longer accepted on thePostHogclient constructor — declare them as env vars on the component instead.apiKeyandhostare no longer arguments to the component's actions (capture,identify,evaluateFlag, etc.).refreshFlagDefinitionsno longer takes any arguments.- The refresh cron is now registered inside the component and only fires when
POSTHOG_PERSONAL_API_KEYis set — delete any app-levelconvex/crons.tsthat existed only to refresh PostHog flags. posthog.refreshFlagDefinitions(ctx)renamed toposthog.reloadFeatureFlags(ctx)for parity withposthog-node.- Local-eval methods (
getFeatureFlag,isFeatureEnabled, etc.) now throw whenPOSTHOG_PERSONAL_API_KEYisn't configured, pointing callers at the remoteevaluateFlagmethods. They still returnundefinedduring the warm-up window when PAK is set but the cron hasn't fetched yet. - New optional
POSTHOG_FLAGS_POLLING_INTERVAL_SECONDSenv 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)
- Requires Convex