Skip to content

Learn connected projects from the API instead of connection strings - #540

Merged
vincent-derks merged 3 commits into
mainfrom
vincentderks/prepare-connected-sources
Oct 1, 2026
Merged

vincent-derks merged 3 commits into
mainfrom
vincentderks/prepare-connected-sources

Conversation

@vincent-derks

@vincent-derks vincent-derks commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Build-time only, no public API added.

@vercel/prepare-flags-definitions learns which other projects to embed by asking the API which projects granted this deployment's project access to their flags (GET /v1/feature-flags/connections/sources, deployment OIDC token as Authorization: Bearer, scoped to the token's project). The flags:projectId= connection string introduced in #517 is removed from @vercel/flags-core and no longer read by the prepare step; a projectId option will take its place. The header plumbing in flags-core stays and is unreachable for now.

Best effort by design: the lookup is capped at 5s and any failure logs at debug level and embeds the project's own definitions exactly as before. Connected projects then fall back to fetching at runtime.

Dependency: the endpoint is not live yet. Until it is, every OIDC build pays one extra round trip that ends in a debug log. This is why the change is safe to release ahead of the API. The endpoint returns the full list (no pagination); connection counts per project are small.

Tests: sources from the API are embedded with the source header, the own project id and invalid ids are skipped, the lookup carries a timeout signal, a failing lookup still embeds own definitions. The flags-core black-box tests for the source header return with the projectId option.

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC
flags-sdk-dev Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC
shirt-shop Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC
shirt-shop-api Ready Ready Preview, v0 Sep 30, 2026 3:20pm UTC

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

A failing auto-discovered sourceProject datafile fetch throws out of prepareFlagsDefinitions, aborting embedding for the entire project (including its own definitions), violating the documented best-effort contract.

Fix on Vercel

Comment thread packages/vercel-flags-core/src/controller/auth.ts
@vincent-derks
vincent-derks merged commit 1a38dee into main Oct 1, 2026
22 checks passed
@vincent-derks
vincent-derks deleted the vincentderks/prepare-connected-sources branch October 1, 2026 09:47
@github-actions github-actions Bot mentioned this pull request Oct 1, 2026

This branch was successfully deployed

6 active deployments
Preview – flags-sdk-dev — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
Preview – flags-sdk-sveltekit-snippets — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
Preview – flags-sdk-snippets — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
Preview – flags-playground — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
Preview – shirt-shop — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
Preview – shirt-shop-api — 03a84a08 Deployed Sep 30, 2026 by vercel[bot]
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