Skip to content
New issue

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

Not enough information in exception when Rate Limiting is encountered #158

Closed
6 tasks done
philomory opened this issue Feb 1, 2019 · 3 comments
Closed
6 tasks done
Milestone

Comments

@philomory
Copy link
Contributor

Description

When rate limiting is encountered, an Auth0::Unsupported exception is raised, whose message only states {"statusCode":429,"error":"Too Many Requests"}. This is because the exception message is generated from only the HTTP response's status and body.

When the Auth0 API returns a 429 response, it includes details about the limits in HTTP response headers; specifically, as noted in Rate Limits, the X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset headers.

It would be good to return this information to the caller when raising an exception due to rate limiting.

Prerequisites

Environment

Please provide the following:

  • Ruby Auth0 version: 4.6.0
  • Ruby version: 2.4.4
  • Rails version (if applicable): N/A
  • Browser version (if applicable): N/A
  • Additional gems that might be affecting your instance: N/A

Reproduction

Easiest way to reproduce is to use a free/trial account with a low rate limit, and then repeatedly call Auth0::Api::V2#logs until an exception is raised.

@philomory
Copy link
Contributor Author

Actually, it might be generally a good idea to make all of the exceptions that Auth0::Mixins::HTTPProxy can raise, inherit from a common Auth0::HTTPError, and provide access to either the RestClient::ExceptionWithResponse or at least the RestClient::Response object in addition to the normal message.

@joshcanhelp
Copy link
Contributor

@philomory - Apologies for not responding any sooner here, I don't recall getting a notification for this.

Thank you for the report here and digging into a potential solution. I'll see if I can get a good solution in place ahead of our next release.

@joshcanhelp
Copy link
Contributor

Fixed in #170

@joshcanhelp joshcanhelp added this to the v4.8.0 milestone Aug 1, 2019
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

No branches or pull requests

2 participants