An annoying one for you. Cloudflare KV only supports KV TTLs >= 60s, but better-auth default rateLimit config now sets 10s as of better-auth/better-auth#4961
You need to override the defaults or your app will crash all the time for auth routes:
{
rateLimit: {
enabled: true,
window: 60, // Minimum KV TTL is 60s
max: 100, // reqs/window
customRules: {
// https://github.com/better-auth/better-auth/issues/5452
"*": {
window: 60,
max: 100,
},
},
},
}
console.warn(`[BetterAuthCloudflare] ttl ${ttl} is less than KV minimum of 60`)
An annoying one for you. Cloudflare KV only supports KV TTLs >= 60s, but better-auth default rateLimit config now sets 10s as of better-auth/better-auth#4961
better-auth/better-auth#5452
You need to override the defaults or your app will crash all the time for auth routes:
Should we consider adding
Math.max(ttl, 60)and/orto https://github.com/zpg6/better-auth-cloudflare/blob/3ff26670edbbd6d33597849d7c6a9ee4056f8086/src/index.ts#L113-L132 ?