Skip to content

fix(installer): QStash região us-east-1 (validação + runtime) - #52

Open
felipetruman wants to merge 2 commits into
thaleslaray:mainfrom
felipetruman:fix/qstash-region
Open

fix(installer): QStash região us-east-1 (validação + runtime)#52
felipetruman wants to merge 2 commits into
thaleslaray:mainfrom
felipetruman:fix/qstash-region

Conversation

@felipetruman

@felipetruman felipetruman commented Jun 16, 2026

Copy link
Copy Markdown

Corrige falha de QStash em conta regional (us-east-1), em dois pontos:

  1. Validação (provision/route.ts): a derivação de região via JWT falhava (o token QStash não é JWT — é base64 de {UserID,Password}), caindo no host global qstash.upstash.io que retorna 404 p/ contas regionais → Erro ao validar token QStash no passo 4. Fixado em qstash-us-east-1.upstash.io.
  2. Runtime (provision/run/run-stream): o provisionamento gravava QSTASH_TOKEN mas não QSTASH_URL → após install limpo, o client @upstash/qstash usava o host global e quebrava campanhas. Agora persiste QSTASH_URL=https://qstash-us-east-1.upstash.io.

Evidência: GET qstash-us-east-1/v2/schedules → 200; global → 404.

Summary by CodeRabbit

  • Chores
    • Standardized QStash endpoint configuration to consistently use the us-east-1 regional endpoint across installation and provisioning processes.
    • Simplified token validation logic by removing region derivation and using a fixed endpoint.

Token QStash não é JWT (base64 de {UserID,Password}), então a derivação
de região via 'iss' sempre falhava e caía no host global qstash.upstash.io,
que retorna 404 para contas regionais — disparando 'Erro ao validar token
QStash' no passo 4 do wizard.

Fixa o host em qstash-us-east-1.upstash.io, alinhando com o sibling
/api/installer/qstash/validate (região obrigatória).
O wizard gravava QSTASH_TOKEN mas não QSTASH_URL. Em produção o client de
runtime (@upstash/qstash) cai no host global qstash.upstash.io, que retorna
404 para contas regionais — quebrando campanhas/workflows após uma instalação
limpa, mesmo com a validação do token passando.

Adiciona QSTASH_URL=https://qstash-us-east-1.upstash.io às env vars upsertadas
nas três variantes de install (provision, run, run-stream), alinhado à região
obrigatória us-east-1 já assumida na validação.
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

@felipetruman is attempting to deploy a commit to the Thales Laray Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4f1c75bc-760d-4260-a20b-66f711fadec6

📥 Commits

Reviewing files that changed from the base of the PR and between 17c69e2 and 4b41922.

📒 Files selected for processing (3)
  • app/api/installer/provision/route.ts
  • app/api/installer/run-stream/route.ts
  • app/api/installer/run/route.ts

📝 Walkthrough

Walkthrough

Token validation in validateQStashToken is simplified to always use the hard-coded qstash-us-east-1.upstash.io host, removing the previous JWT-payload-based region detection. All three installer routes (provision, run, run-stream) now also inject a QSTASH_URL environment variable targeting the us-east-1 endpoint into the deployed Vercel project.

Changes

QStash us-east-1 Region Hardcoding

Layer / File(s) Summary
Token validation fixed to us-east-1 host
app/api/installer/provision/route.ts
validateQStashToken removes JWT payload region detection and hard-codes the us-east-1 QStash host for all schedule validation calls.
QSTASH_URL env var injected in all installer routes
app/api/installer/provision/route.ts, app/api/installer/run/route.ts, app/api/installer/run-stream/route.ts
Each installer route appends a QSTASH_URL entry (https://qstash-us-east-1.upstash.io) to the env vars upserted into the target Vercel project alongside the existing QSTASH_TOKEN.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • thaleslaray/smartzap#14: Introduced JWT iss-based region detection in app/api/installer/qstash/validate/route.ts, which is the dynamic behavior this PR replaces with a hard-coded us-east-1 endpoint.

Poem

🐇 Hop, hop, no more decoding JWT hops,
The region is east-one, and the guessing stops!
QSTASH_URL is set, crisp as morning dew,
Three routes aligned, all pointing somewhere true.
One fixed endpoint, no more region chase —
This bunny prefers a hardcoded place! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references 'QStash região us-east-1' with focus on validation and runtime, directly matching the PR's two-part fix for token validation and runtime persistence issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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