We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
workers-rs
0.5.0
wrangler
3.106.0
When trying to retrieve a RateLimiter with Env::get_binding the following error occurs:
RateLimiter
Env::get_binding
Binding cannot be cast to the type RateLimiter from Ratelimit
I have the following in my wrangler.toml:
wrangler.toml
[[unsafe.bindings]] name = "MY_RATE_LIMITER" type = "ratelimit" namespace_id = "1001" simple = { limit = 10, period = 60}
And the rate limiter is being retrieved like so:
// ... let rate_limiter = cx .env .get_binding::<RateLimiter>("MY_RATE_LIMITER")?; let rate_limit_outcome = rate_limiter .limit(format!("user_id:{}", claims.user_id)) .await?; if !rate_limit_outcome.success { return Response::error( "Rate limit exceeded.", StatusCode::TOO_MANY_REQUESTS.as_u16(), ); }
Related GitHub Discussion: #692
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is there an existing issue for this?
What version of
workers-rs
are you using?0.5.0
What version of
wrangler
are you using?3.106.0
Describe the bug
When trying to retrieve a
RateLimiter
withEnv::get_binding
the following error occurs:Steps To Reproduce
I have the following in my
wrangler.toml
:And the rate limiter is being retrieved like so:
Related GitHub Discussion: #692
The text was updated successfully, but these errors were encountered: