fix(onboarding): forward GitHub App install callback to /api/github/callback#1
Merged
Merged
Conversation
The GitHub App setup_url is configured as /onboarding, so after install GitHub redirects here with ?installation_id=&setup_action=install. The page previously ignored these params, so the installation was never linked to the org and repos never appeared in the dashboard. Now we detect the installation_id and redirect to /api/github/callback which calls POST /api/v1/orgs/current/github/link, syncs repos, and then redirects to /repos. No logic is duplicated — the callback route already handles the full linking + sync flow correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Root Cause
The GitHub App's
setup_urlis configured ashttps://app.codesheriff.dev/onboarding. After a user installs the App, GitHub redirects to this URL with?installation_id=NNN&setup_action=install. However,OnboardingPagewas not readingsearchParams, so it silently dropped theinstallation_idand the installation was never linked to the org — leaving the dashboard permanently empty.The
/api/github/callbackroute (added in44208f7) was purpose-built to callPOST /api/v1/orgs/current/github/link, sync repos, then redirect to/repos— but was never reachable because thesetup_urlpoints to/onboardinginstead.Fix
When
?installation_idis present in the onboarding page's query params, immediately redirect to/api/github/callbackwith those params. The callback handler takes care of the rest.The webhook-based fallback (
installation.created) remains in place but was unreliable due to org-matching heuristics.Test Plan
/onboarding?installation_id=…→/api/github/callback?installation_id=…→/repos/onboarding(no params) still works normallyResidual Risk
If the
setup_urlis ever corrected to point directly at/api/github/callback, the forward here becomes a harmless no-op (theinstallation_idcheck is skipped on direct/onboardingloads).🤖 Generated with Claude Code