feat: environment mapping in Vercel connect flow
@MattBro is already working on this.
Since Mar 27, 2026.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Problem
When connecting an existing PostHog account to Vercel, users can only link one PostHog project. But many users have separate PostHog projects for prod vs dev (e.g., a sandbox project for development). They want to map different PostHog projects to different Vercel environments:
- Vercel production → PostHog prod project
- Vercel preview/dev → PostHog sandbox project
Currently we push one set of env vars (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NEXT_PUBLIC_POSTHOG_HOST) for all environments. Vercel's API supports environmentOverrides to set different values per environment, and we already have the serializer for it.
Reported by Valentin (dotworld) in the support thread.
Solution
Update the connect flow to show environment mapping in the project picker:
- After selecting an org, show a mapping UI: one row per Vercel environment (production, preview, development) with a PostHog project dropdown each
- Default all three to the same project (current behavior)
- If the user has multiple projects, they can assign different ones per environment
- On submit, create Integration resources for each unique team, call
import_resourcewithenvironmentOverridesin secrets - Flag sync comes from the production project
What exists today
- Vercel secrets API supports
environmentOverrides(development,preview,production) VercelSecretEnvironmentOverridesSerializeralready exists invercel_resource.py- The connect flow already has org + project pickers (from #52480)
Work
- Update
VercelConnectLinkSerializerto accept environment mappings instead of singleteam_id - Update
completeendpoint to handle multiple teams and passenvironmentOverridestoimport_resource - Update
VercelConnect.tsxto show environment mapping UI - Update flag sync to use the production team as primary
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.