Skip to content

fix(adapter-posthog): don't start local-evaluation polling from POSTHOG_PERSONAL_API_KEY#432

Open
sarmah-rup wants to merge 1 commit into
vercel:mainfrom
sarmah-rup:fix/posthog-no-implicit-local-evaluation
Open

fix(adapter-posthog): don't start local-evaluation polling from POSTHOG_PERSONAL_API_KEY#432
sarmah-rup wants to merge 1 commit into
vercel:mainfrom
sarmah-rup:fix/posthog-no-implicit-local-evaluation

Conversation

@sarmah-rup

@sarmah-rup sarmah-rup commented Jul 11, 2026

Copy link
Copy Markdown

Problem

The default postHogAdapter forwards POSTHOG_PERSONAL_API_KEY and featureFlagsPollingInterval: 10_000 into the runtime posthog-node client. In posthog-node, a personal API key enables local evaluation, which starts a per-process feature-flag poller.

On serverless deployments each warm process runs its own 10s poller, producing large volumes of PostHog feature-flag requests unrelated to real traffic.

Root cause: POSTHOG_PERSONAL_API_KEY is only needed for provider data discovery (getProviderData), which reads it independently of the runtime client. The two concerns were coupled only in the default singleton.

Changes

The default adapter no longer forwards the personal API key or polling interval to the runtime client. Local evaluation remains fully available by constructing the adapter explicitly with createPostHogAdapter and passing personalApiKey / featureFlagsPollingInterval in postHogOptions — matching the workaround described in the issue.

Testing

Added a regression test asserting the default runtime client is constructed without personalApiKey / featureFlagsPollingInterval even when POSTHOG_PERSONAL_API_KEY is set.

Note / scope

If you'd prefer an explicit opt-in flag to re-enable local evaluation on the default adapter instead (issue option 2), happy to adjust.

Closes #393

@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

@sarmah-rup is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostHog adapter starts local-evaluation polling when POSTHOG_PERSONAL_API_KEY is set

1 participant