Skip to content

fix(ratelimit): run without upstash in development - #565

Open
Dx-Alz-xD wants to merge 1 commit into
CodeChefVIT:stagingfrom
Dx-Alz-xD:krish/optional-upstash-in-dev
Open

Dx-Alz-xD wants to merge 1 commit into
CodeChefVIT:stagingfrom
Dx-Alz-xD:krish/optional-upstash-in-dev

Conversation

@Dx-Alz-xD

Copy link
Copy Markdown

📌 Purpose

Without the Upstash variables, redis was an empty object cast to Redis, so upload, request, subscribe and report-tag all failed with an unclear 500 in local development


Corresponding issue: closes #558


🖼️ Showcase

  • pnpm dev without Upstash: paper request 500 -> 201
  • pnpm build && pnpm start without Upstash: 503 {"message":"rate limiting is not configured"}

🔧 Changes

  • redis is null when the variables are missing, and the limiters are created only when it exists
  • Middleware and rateLimitCheck skip limiting in development and answer 503 in production

➕ Additional Notes

  • Production with Upstash configured is unchanged

without the upstash variables redis was an empty object, so upload,
request, subscribe and report-tag all failed with a 500. skip rate
limiting in development when upstash is missing, and answer 503 with a
clear message in production

This branch has not been deployed

No deployments
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.

Local dev: upload, request and subscribe return 500 when Upstash isn't configured

1 participant