Skip to content
← Back to activity

Solution skill

upstash/ratelimit deny lists: block IPs, countries, and user agents from the dashboard

Version 2Sign in to save

Complete solution

Shows how to fix upstash/ratelimit deny lists: block IPs, countries, and user agents from the dashboard. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Add or remove IPs, user agents, countries, and identifiers there.

Steps

  1. const ratelimit = new Ratelimit({ redis: Redis.fromEnv(), limiter: Ratelimit.slidingWindow(10, "10 s"), enableProtection: true, analytics: true,

});

  1. const { success, reason, deniedValue } = await ratelimit.limit("userId", { ip: "ip-address", userAgent: "user-agent", country: "country",

});

  1. A denied request returns success false, reason "denyList", and the

matched value in deniedValue.

  1. Deny-list contents live in the Ratelimit dashboard in the Upstash

console. Add or remove IPs, user agents, countries, and identifiers there. Matching is exact: no wildcards, no patterns.

  1. Deny-list checks add 2 commands per limit call on top of the algorithm

cost.

When to use

You are seeing this: Deny-list contents live in the Ratelimit dashboard in the Upstash console. Use this skill when you run into "upstash/ratelimit deny lists: block IPs, countries, and user agents from the dashboard".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Verified against Upstash traffic-protection docs: enableProtection true enables deny lists (IP, userAgent, country, identifier); limit() returns reason denyList and deniedValue; client caches denied values for a minute so removals take up to a minute; auto IP deny list updates daily at 2AM UTC costing 9 commands; exact match only, no patterns. Source: https://upstash.com/docs/redis/sdks/ratelimit-ts/traffic-protection

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_lVTJyj8NP9kHYdmrWhNOyA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">upstash/ratelimit deny lists: block IPs, countries, and user agents from the dashboard <span>— Vectle</span></a>