Skip to content

deploy: PostHog token injected at build from a repository variable (Vercel sensitive env pulled as "[SENSITIVE]") - #2542

Merged
Flotapponnier merged 1 commit into
devfrom
fix/posthog-build-key
Sep 20, 2026
Merged

Flotapponnier merged 1 commit into
devfrom
fix/posthog-build-key

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Root cause of PostHog receiving nothing since 2026-08-24: both deploy workflows run vercel pull then vercel build; Vercel returns env vars flagged Sensitive as the literal string [SENSITIVE], and that string was compiled into the client bundle as the PostHog token (posthog.init("[SENSITIVE]", …) on production today). PostHog accepts the event at ingest and drops it silently, so nothing failed loudly.

Fix: the project token (public by nature, it ships to every browser) is a GitHub repository variable NEXT_PUBLIC_POSTHOG_KEY (set), passed as env to the build steps; process.env takes precedence over the pulled .env file. The OCB PostHog project (org Openchainbench, id 619165) currently holds zero events over 90 days.

Needs the same change on main for production (prod-deploy.yml runs from main).

🤖 Generated with Claude Code

https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw

…ariable; vercel pull hands sensitive env vars back as the literal "[SENSITIVE]" and that string shipped as the PostHog token since 2026-08-24

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw
@Flotapponnier
Flotapponnier merged commit 1425bc8 into dev Sep 20, 2026
1 of 2 checks passed
Flotapponnier added a commit that referenced this pull request Sep 20, 2026
…ariable; vercel pull hands sensitive env vars back as the literal "[SENSITIVE]" and that string shipped as the PostHog token since 2026-08-24 (#2542) (#2543)

Claude-Session: https://claude.ai/code/session_01HJgbZCqjR4nvCfcJSzofbw



(cherry picked from commit 1425bc8)

Co-authored-by: Flotapponnier <florent@mobula.io>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants