Skip to content

Fix RateLimiter binding name#701

Closed
maxdeviant wants to merge 1 commit intocloudflare:mainfrom
deviant-forks:fix-rate-limiter-binding-name
Closed

Fix RateLimiter binding name#701
maxdeviant wants to merge 1 commit intocloudflare:mainfrom
deviant-forks:fix-rate-limiter-binding-name

Conversation

@maxdeviant
Copy link
Copy Markdown
Contributor

This PR fixes an issue where the RateLimiter could not be retrieved with Env::get_binding, as described in #700.

When trying to retrieve the rate limiter I was getting the following error:

Binding cannot be cast to the type RateLimiter from RateLimit

From what I can tell, the underlying issue is that the runtime constructor name is actually Ratelimit, based on this code here:

if obj.constructor().name() == Self::TYPE_NAME {

I was able to fix this by updating the type name from RateLimiter to Ratelimit in the EnvBinding impl.

If there is a different way this should be fixed, I am happy to pursue other avenues.

@guybedford
Copy link
Copy Markdown
Collaborator

Thanks for sharing the PR. It would be great to see a test here and a rebase. I've opened #755 to follow-up on landing as well now.

@guybedford
Copy link
Copy Markdown
Collaborator

Landed this one in #755.

@guybedford guybedford closed this Jun 17, 2025
@maxdeviant
Copy link
Copy Markdown
Contributor Author

Landed this one in #755.

Thank you!

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.

2 participants