Version Packages - #456
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dferber90
approved these changes
Jul 29, 2026
dferber90
enabled auto-merge (squash)
July 29, 2026 14:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
@flags-sdk/posthog@1.0.0
Major Changes
#436
aec3c03Thanks @dferber90! - Modernize the PostHog adapter. This release is breaking in five ways:NEXT_PUBLIC_POSTHOG_KEY→POSTHOG_PROJECT_API_KEYandNEXT_PUBLIC_POSTHOG_HOST→POSTHOG_HOST.POSTHOG_SECRET_KEY.isFeatureEnabled()/featureFlagValue()/featureFlagPayload()becomepostHogAdapterandpostHogAdapter.payload.keyis used as the PostHog flag key verbatim. The old "read until the first." convention is gone.sendFeatureFlagEventsoption and thefeatureFlagPayloadgetValuemapper are removed.It also upgrades
posthog-nodefrom v4.11.1 to v5.45.0 (which raises the requiredNode.js version), adds bulk evaluation support, drops
posthog-node's runtimedeprecation warnings, and removes the unused
@vercel/edge-configdependency.This release requires
flags@^4.2.0, which is where the uninvoked-adapter shorthandand bulk evaluation landed.
Environment variables
The adapter runs server-side only, so its credentials were never meant to be exposed
to the browser. The
NEXT_PUBLIC_prefixed variables are renamed accordingly, and theproject API key variable now says which key it wants:
POSTHOG_HOSTis also whatgetProviderDataderives the app host from, andPOSTHOG_PERSONAL_API_KEY/POSTHOG_PROJECT_IDare unchanged.Explicit local vs. remote evaluation
Previously the default
postHogAdapterpassedPOSTHOG_PERSONAL_API_KEYinto theruntime
posthog-nodeclient. When that variable was set, this enabled localevaluation and started a feature-flag poller in every warm server process — on
serverless that could generate a large, traffic-independent volume of PostHog feature
flag requests, as a side effect of a credential you may only have set for the Flags
Explorer.
The default adapter now evaluates flags remotely unless you opt in to local
evaluation by setting
POSTHOG_SECRET_KEY(aphs_...project secret key). When set,posthog-nodepolls flag definitions and evaluates flags in-process. When usingcreatePostHogAdapter, control it explicitly viapostHogOptions(
secretKey+enableLocalEvaluation).POSTHOG_PERSONAL_API_KEYcontinues to be used only bygetProviderData(FlagsExplorer discovery) and no longer affects runtime evaluation.
Single callable adapter
The three adapter methods (
isFeatureEnabled,featureFlagValue,featureFlagPayload)are collapsed into a single callable adapter, matching
@flags-sdk/vercel. Pass ituninvoked or invoked, and use
.payloadfor a flag's attached payload:isFeatureEnabledandfeatureFlagValuemerged into the value adapter, which returnswhatever PostHog evaluated the flag to: a boolean for a boolean flag, the variant
stringfor a multivariate flag. Type the flag (flag<boolean>,flag<string>) todescribe the value you expect.
Note that
isFeatureEnabledused to coerce a multivariate flag's variant totrue.Nothing coerces now, so a flag that previously read
trueviaisFeatureEnabledwillread e.g.
'variant-a'. Declaringflag<boolean>only changes the TypeScript type —if you relied on the boolean, narrow the value in your own
decideor at the call site.A flag's
keyis now used as the PostHog feature flag key verbatim. The previousconvention of trimming everything after the first
.(somy-flag.variantread thePostHog flag
my-flag) has been removed; use the exact PostHog flag key as your flagkey.Upgraded
posthog-node, migrated toevaluateFlags, added bulk evaluationposthog-nodeis upgraded from v4.11.1 to v5.45.0. Internally the adapter now uses itsevaluateFlagsinstead of the deprecatedisFeatureEnabled/getFeatureFlag/getFeatureFlagPayloadmethods, removing the deprecation warnings those log at runtime.The adapter also implements
bulkDecide, soevaluate()resolves flagsthat share an
identifysource through a singleevaluateFlagscall — one/flagsrequest when evaluating remotely, one in-process evaluation when evaluating locally.
Flag values and flag payloads are batched separately, so a flag and its payload still
resolve through two calls.
The per-call
sendFeatureFlagEventsoption and thefeatureFlagPayloadgetValuemapper are removed (neither has an
evaluateFlagsequivalent); map payloads in yourown flag code instead.
Node.js version requirement
posthog-node@5.45.0requires Node.js^20.20.0 || >=22.22.0, and this adapter nowdeclares the same
enginesconstraint.Removed
@vercel/edge-configdependencyThe adapter never used it. It is dropped from
dependencies(and from the packagekeywords), so installs no longer pull it in.