fix(integrations): connect vercel when the code exchange omits user_id

Abierto
#799 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend

Línea de trabajo

Read src/lib/adapters/vercel/schemas.ts and src/lib/adapters/vercel/index.ts, then check a real code exchange for team and Hobby installs using the integration registered under #88. Update the schema, credential handling, tests and fixtures, and docs/providers/vercel.md based on the observed responses. Done when the acceptance criteria pass and the listed typecheck, lint and adapter tests succeed.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

area: integrations bug impact: high priority: P1 size: S

Context

Found while re-reading Vercel's token documentation for #757 on 2026-12-02.

StackDash requires user_id in the code exchange response (TokenResponseSchema, src/lib/adapters/vercel/schemas.ts) and in the stored credential metadata (readScope, src/lib/adapters/vercel/index.ts), and a Hobby account is identified by it (listAccounts, sync, and webhook routing by payload.user.id).

Both Vercel documentation pages still show user_id in the code exchange response and in the client credentials response (Building Integrations with Vercel REST API, "Exchange code for Access Token"; Migrating to Short-Lived Access Tokens, "Request a short-lived token"). Vercel's own reference integration does not rely on it: vercel/example-marketplace-integration commit a06457a4 ("Renew installation access tokens (#147)", 2026-11-07) made user_id optional in its code exchange schema (lib/vercel/external-api.ts, test "accepts authorization-code responses with an optional legacy user ID"), and its README says the "Authorization-code exchange accepts the new expires_in response and optional user_id field".

Impact if Vercel omits it for an integration that issues short-lived tokens: every Vercel connect fails at the code exchange with invalid_response, so no Vercel account can connect on the integration #88 registers. Unverified until that integration exists.

Plan

  1. Check a real code exchange on the integration registered under #88 (development integration first): does the response carry user_id, for a team install and for a Hobby install?
  2. If it can be missing: make user_id optional in the code exchange schema. A team install does not need it (the account is team_id). For a Hobby install, take it from the client credentials response exchangeCode requests right after the exchange (#757), which the documentation shows with user_id, and refuse the connection with a clear error only when neither carries one.
  3. Keep readScope working for credentials stored before the change.

Acceptance criteria

  • A team install whose code exchange response has no user_id connects and syncs.
  • A Hobby install with no user_id in either response is refused with invalid_response, never stored half-identified.
  • docs/providers/vercel.md states what was observed and removes the Unverified entry.
  • Playwright e2e: not needed, the simulated Vercel flow does not call the token endpoint.

Files and areas

src/lib/adapters/vercel/index.ts, src/lib/adapters/vercel/schemas.ts, their tests and fixtures, docs/providers/vercel.md.

Non-goals: token renewal itself (#757), the integration registration (#88).

Verification

npm run typecheck, npm run lint, npx vitest run src/lib/adapters/vercel.


Branch: <issue-number>-vercel-optional-user-id

Model: anthropic/claude-opus-5-5 | Reasoning effort: max

Lenguaje dominante
TypeScript
Estrellas
13
Forks
2
Merge medio
5 h 20 min
PR fusionados (30 d)
287

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de eddiejaoude/StackDash

Todos los issues de eddiejaoude/StackDash

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.