feat(integrations): push Vercel deployment and uninstall events by webhook

Aperta
#422 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, playwright, typescript
Ambito
api, backend

Direzione di ricerca

Start by reading the webhook contract from #28 and the existing adapter in src/lib/adapters/vercel/ to see how polling currently emits deployment events, then read docs/providers/vercel.md for the signature and envelope details. Work through the handler in order: constant-time HMAC SHA-1 verification of x-vercel-signature on the raw body, dedup on envelope id, team-to-connection mapping, then event mapping and integration-configuration.removed. Cover it with unit tests on recorded payloads plus the Playwright spec for the simulated provider; done is all acceptance boxes green under npm run lint, npm run typecheck, npm test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: integrations blocked enhancement impact: medium priority: P1 size: S

Context

The Vercel adapter (#47, closed) polls deployments hourly. Eddie's decision on #28 (2026-11-14): webhooks first, polling as the backfill, and webhooks are in the MVP. Vercel can push without any new scope: the webhook URL lives on the integration, and deliveries are signed with the client secret the adapter already has.

From docs/providers/vercel.md, "Webhooks (Post-MVP)", checked against Vercel's docs on 2026-10-31:

Item Value
Where the URL lives One Webhook URL per integration, set in the Integrations Console, with event checkboxes
Signature x-vercel-signature: hex HMAC SHA-1 of the raw body, keyed with the integration's client secret. Rotating the secret changes the key
Envelope { type, id, createdAt, region, payload }. Deployment payloads carry payload.team.id, payload.project.id, payload.deployment.{id,url,name}, payload.target
Delivery 30 second timeout. Non-2xx responses are retried with backoff for up to 24 hours
Useful events deployment.created, deployment.succeeded, deployment.ready, deployment.error, deployment.canceled, project.created, project.removed, integration-configuration.removed
Not pushed Billing charges and usage. Spend stays polled

Plan

  1. Implement the Vercel webhook declaration from the contract #28 adds: verify x-vercel-signature against the raw body in constant time, deduplicate on the envelope id.
  2. Map payload.team.id (or the user id for a personal account) to the connection. Unknown teams are acknowledged and dropped.
  3. Deployment events become the event types the adapter already emits, so a deployment seen by webhook and then by polling shows once.
  4. integration-configuration.removed marks the connection as needing a reconnect at once.
  5. project.created and project.removed update the connection's accounts without a reconnect, if the adapter's accounts are projects; otherwise ignore them.
  6. Docs: docs/providers/vercel.md (rename the section to "Webhooks", update uninstall detection and self-hosted registration to set the Webhook URL and events), docs/operations/oauth-apps.md.

Acceptance criteria

  • A signed deployment delivery reaches the timeline within a minute, without waiting for a sync.
  • A deployment seen by webhook and by polling shows once.
  • Unsigned, wrongly signed, or repeated deliveries are rejected or ignored, and logged without their body.
  • integration-configuration.removed marks the connection as needing a reconnect.
  • Polling still runs and still fills in charges and any missed delivery.
  • Unit tests on recorded, sanitized payloads from Vercel's documented samples. No live calls in CI.
  • Playwright e2e: a signed delivery for the simulated Vercel provider appears on the timeline.

Files and areas

  • src/lib/adapters/vercel/ (webhook handler, schemas, fixtures, tests), the webhook route from #28, docs/providers/vercel.md, docs/operations/oauth-apps.md.
  • Non-goals: new scopes, domain events, and pushing spend (no webhook exists for it).

Verification

  • npm run lint, npm run typecheck, npm test
  • The Playwright spec for the simulated delivery.

Depends on

  • #28 Ingest provider webhooks (contract, route, deduplication)
  • #47 Add the Vercel adapter (closed)

Branch: <issue-number>-vercel-webhooks
Closes with a Closes #<issue-number> footer on the commit or pull request.

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

Lingua principale
TypeScript
Stelle
1
Fork
1
Merge medio
6h 56m
PR unite (30g)
136

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di eddiejaoude/StackDash

Tutte le issue di eddiejaoude/StackDash

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.