Skip to content

feat(web): accept KV_REST_API_* envs from Upstash KV integration#51

Merged
bolin8017 merged 1 commit into
mainfrom
fix/upstash-env-fallback
Apr 18, 2026
Merged

feat(web): accept KV_REST_API_* envs from Upstash KV integration#51
bolin8017 merged 1 commit into
mainfrom
fix/upstash-env-fallback

Conversation

@bolin8017
Copy link
Copy Markdown
Owner

Summary

Vercel Marketplace exposes two Upstash integrations that point at the same Redis service:

Integration Env vars populated
Upstash for Redis `UPSTASH_REDIS_REST_URL` / `UPSTASH_REDIS_REST_TOKEN`
Upstash KV `KV_REST_API_URL` / `KV_REST_API_TOKEN`

`Redis.fromEnv()` only reads the first pair, so picking "Upstash KV" silently drops back to the in-memory fallback. This PR replaces the call with a `resolveUpstashCreds()` helper that accepts either pair (prefers Upstash-native names).

`.env.example` documents both options; `turbo.json` env-var list updated so the build cache key includes whichever pair is set.

Test plan

  • `pnpm --filter @caffecode/web exec tsc --noEmit` — clean
  • `pnpm --filter @caffecode/web exec vitest run` — 571/571 pass

🤖 Generated with Claude Code

…gration

Vercel Marketplace has two Upstash integrations that point at the same
Redis-compatible service but inject different env var names:

  - "Upstash for Redis" → UPSTASH_REDIS_REST_URL / UPSTASH_REDIS_REST_TOKEN
  - "Upstash KV"        → KV_REST_API_URL       / KV_REST_API_TOKEN

`Redis.fromEnv()` only reads the first pair, so users who install the
"Upstash KV" flavour silently fall through to the in-memory fallback.

Replace `Redis.fromEnv()` with an explicit `resolveUpstashCreds()` that
prefers the Upstash-native names and falls back to the KV-flavoured
names when the first pair is absent. Either integration now works with
zero config. `.env.example` and `turbo.json` env-var list both updated.

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

vercel Bot commented Apr 18, 2026

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

Project Deployment Actions Updated (UTC)
caffecode Ready Ready Preview, Comment Apr 18, 2026 8:58am

@github-actions
Copy link
Copy Markdown

📊 Coverage Report

Package Statements Branches Functions Lines
shared 92.22% ❌ (≥95%) 87.74% ❌ (≥90%) 96.87% ✅ (≥95%) 91.88% ❌ (≥95%)
web 94.03% ✅ (≥90%) 89.26% ✅ (≥85%) 96.5% ✅ (≥90%) 94.77% ✅ (≥90%)

🤖 Generated by CI · thresholds enforced via vitest

@bolin8017 bolin8017 merged commit 285d9e8 into main Apr 18, 2026
3 checks passed
@bolin8017 bolin8017 deleted the fix/upstash-env-fallback branch April 18, 2026 08:58
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