fix(qstash): pin client to US region via QSTASH_URL#3584
Conversation
Upstash's global endpoint routed us to eu-central-1 even though our
prod QStash project lives in us-east-1, so schedules.list() 404'd with
"user not found in this region." Pass an explicit baseUrl from a new
QSTASH_URL env var so every call hits the right region.
- apps/api/src/env.ts: add QSTASH_URL.
- evaluate route + setup script: pass baseUrl to new Client({...}).
- deploy-{preview,production} + setup-automations-schedule workflows:
plumb the secret through.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis pull request introduces Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR fixes a production routing bug where Upstash's global QStash endpoint was directing traffic to
Confidence Score: 5/5Safe to merge — targeted, minimal change that correctly resolves the region-routing 404 with no logic regressions. baseUrl is a documented @upstash/qstash Client option, all three call-sites are updated consistently, secret plumbing is complete across all workflows, and the Receiver is correctly left unchanged. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/api/src/env.ts | Adds required QSTASH_URL server env var with URL validation — correctly placed alongside other QStash secrets, no issues. |
| apps/api/src/app/api/automations/evaluate/route.ts | Passes baseUrl: env.QSTASH_URL to the QStash Client constructor to pin to US region; Receiver intentionally left unchanged as it only does local HMAC verification. |
| apps/api/scripts/setup-automations-schedule.ts | Reads and validates QSTASH_URL from env, then passes it as baseUrl to the Client; idempotency logic unchanged and correct. |
| .github/workflows/deploy-production.yml | Correctly threads QSTASH_URL secret into both the job env block and the explicit --env flags of vercel deploy. |
| .github/workflows/deploy-preview.yml | Correctly threads QSTASH_URL secret into both the job env block and the explicit --env flags of vercel deploy. |
| .github/workflows/setup-automations-schedule.yml | Adds QSTASH_URL secret to the Create schedule step env, completing the plumbing for the one-shot setup script. |
Reviews (1): Last reviewed commit: "fix(qstash): pin client to QSTASH_URL so..." | Re-trigger Greptile
Summary
Our prod QStash project lives in us-east-1 but Upstash's global endpoint was routing us to eu-central-1, so the first scheduler setup run 404'd with "user not found in this region." Pass an explicit baseUrl from a new `QSTASH_URL` secret.
Once this lands:
Test plan
Summary by cubic
Pin
@upstash/qstashto our US region by introducingQSTASH_URLand passing it asbaseUrl. Fixes cross‑region routing that caused "user not found in this region" 404s for schedule setup and evaluator cron.Bug Fixes
QSTASH_URLinapps/api/src/env.ts.baseUrltonew Client({...})in the evaluate route andsetup-automations-schedulescript.QSTASH_URLthroughdeploy-production,deploy-preview, andsetup-automations-scheduleworkflows.Migration
QSTASH_URLsecret pointing to the us-east-1 endpoint (e.g., https://qstash-us-east-1.upstash.io).Written for commit 78c83ca. Summary will update on new commits.
Summary by CodeRabbit