Conversation
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.
Fix GitHub OAuth redirects for hosted split-origin deployments by returning an absolute API URL instead of a dashboard-relative path.
Motivation
#825
When hosted on separate origins, the dashboard received:
/api/github/connect/redirect?install_state=...
The browser resolved this against https://app.openship.io , resulting in a 404. The redirect must target the API origin at https://api.openship.io .
Related issue
None — bug fix.
Changes
• apps/api
• Use resolveApiPublicUrl() for GitHub OAuth redirect URLs.
• Apply the fix to both App/OAuth connection paths.
• Add a regression test covering the absolute API origin and encoded install state.
Verification
DEPLOY_MODE=desktop bunx vitest run apps/api/test/modules/github/github.controller.test.ts
✓ apps/api/test/modules/github/github.controller.test.ts (4 tests) 106ms
Test Files 1 passed (1)
Tests 4 passed (4)
bun run --cwd apps/api lint
$ tsc --noEmit
The formatter was initially run repository-wide and generated unrelated changes across many files. Those changes were reverted, and only the two changed files were formatted individually:
bunx prettier --write
apps/api/src/modules/github/github.controller.ts
apps/api/test/modules/github/github.controller.test.ts
Checklist
✓ One change per PR — one bug, or one agreed feature, with nothing unrelated bundled in
✓ The diff is scoped — no reformatting or lint fixes on lines I wasn't otherwise changing
✓ A test fails without this change and passes with it
• bun run test , bun run --cwd lint , and bun format all pass locally — targeted API tests and lint pass; repository-wide bun format was not retained because it modified unrelated files
✓ I understand every line of this diff and can explain it in review