Skip to content

fix(web): BFF 204 handling + scope smoke rollback (Fixes ORBIT-WEB-3) - #288

Merged
thomasluizon merged 2 commits into
mainfrom
fix/bff-204-null-body
Jun 24, 2026
Merged

fix(web): BFF 204 handling + scope smoke rollback (Fixes ORBIT-WEB-3)#288
thomasluizon merged 2 commits into
mainfrom
fix/bff-204-null-body

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Incident

The prod-smoke run triggered by #253's merge went red, and Sentry fired ORBIT-WEB-3 — both from one root cause.

Root cause

The BFF catch-all proxy built every upstream response with new NextResponse(await source.text(), { status }). On a 204/205/304 the upstream body is empty, but source.text() returns an empty string (not null), and the Response constructor rejects any non-null body on a null-body statusTypeError: Response constructor: Invalid response status code 204. So any endpoint returning 204 (e.g. PUT /profile/onboarding, which the smoke setup calls) 500'd through the BFF. That broke the smoke's expect(onboarding.ok()) and is a real prod bug for onboarding completion.

Fixes

  1. BFF (app/api/[...path]/route.ts) — skip reading the body and pass null for null-body statuses (204/205/304). + regression test in proxy-route.test.ts (4/4 green locally).
  2. CI (smoke-prod.yml) — the rollback step ran vercel rollback <url> without --scope, so the team-scoped token failed with "Deployment belongs to a different team" — the rollback safety net was broken. Added --scope "$VERCEL_ORG_ID" (vercel/vercel#11712).

Notes

Fixes ORBIT-WEB-3

🤖 Generated with Claude Code

thomasluizon and others added 2 commits June 23, 2026 22:44
The catch-all proxy built every response with new NextResponse(await source.text(), { status }). For a 204/205/304 the body is empty, but source.text() yields an empty STRING, and the Response constructor rejects any non-null body on a null-body status -> TypeError: Response constructor: Invalid response status code 204. Any endpoint returning 204 (e.g. PUT /profile/onboarding) 500'd through the BFF. Skip the body and pass null for null-body statuses.

Fixes ORBIT-WEB-3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
vercel rollback <url> ran without --scope, so a team-scoped token resolved the wrong scope and failed with 'Deployment belongs to a different team', leaving the rollback safety net broken. Pass --scope $VERCEL_ORG_ID. See vercel/vercel#11712.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 24, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
orbit-ui-mobile-web Ignored Ignored Jun 24, 2026 1:45am

Request Review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Review: fix(web): BFF 204 handling + scope smoke rollback. Verdict: APPROVE -- no Critical or High findings across all 13 dimensions. Correctness: NULL_BODY_STATUSES guards 204/205/304 per HTTP spec; regression test validates the 204 path. Parity: verified, apps/mobile/lib/api-client.ts handles 204 directly without constructing a Response -- sanctioned BFF-vs-direct-API difference. Security: VERCEL_ORG_ID already in workflow env at line 26, --scope addition is correct. Clean fix, root cause addressed, no regressions.

@sonarqubecloud

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit fa84da1 into main Jun 24, 2026
10 checks passed
@thomasluizon
thomasluizon deleted the fix/bff-204-null-body branch June 24, 2026 01:54
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.

1 participant