Title: [FR] Improve exception handling for rate limiting · Issue #666 · firebase/firebase-admin-python · GitHub
Open Graph Title: [FR] Improve exception handling for rate limiting · Issue #666 · firebase/firebase-admin-python
X Title: [FR] Improve exception handling for rate limiting · Issue #666 · firebase/firebase-admin-python
Description: Is your feature request related to a problem? Please describe. When using the SDK to create email action links, such as for password reset or email verifications, Firebase is strongly rate limiting for good reason. However, it is current...
Open Graph Description: Is your feature request related to a problem? Please describe. When using the SDK to create email action links, such as for password reset or email verifications, Firebase is strongly rate limiting...
X Description: Is your feature request related to a problem? Please describe. When using the SDK to create email action links, such as for password reset or email verifications, Firebase is strongly rate limiting...
Opengraph URL: https://github.com/firebase/firebase-admin-python/issues/666
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FR] Improve exception handling for rate limiting","articleBody":"**Is your feature request related to a problem? Please describe.**\r\n\r\nWhen using the SDK to create email action links, such as for password reset or email verifications, Firebase is strongly rate limiting for good reason. However, it is currently impossible to (programmatically) detect whether the reason for failure was indeed rate limiting, or something else, since in both cases a generic `InvalidArgumentError` exception is raised.\r\n\r\n**Describe the solution you'd like**\r\n\r\nA way to distinguish rate limiting from other client or server side errors, so that my API is able to return 429 or 503 responses with a `Retry-After` header instead of a generic 500 response in those cases.\r\n\r\n**Describe alternatives you've considered**\r\n\r\nIn order to prevent my API from returning generic 500 I'm considering to implement my own rate limiting in front now. However, that is less elegant since I would need to heuristically match Firebase's rate limiting algorithm in order to prevent emitting 500's anyway.\r\n\r\n**Additional context**\r\n\r\nCurrently the `RESET_PASSWORD_EXCEED_LIMIT` error code from Firebase is swallowed and converted into a `INVALID_ARGUMENT` code, because this type of exception is not special-cased:\r\n\r\n InvalidArgumentError('Error while calling Auth service (RESET_PASSWORD_EXCEED_LIMIT).')\r\n\r\nNote that the same holds for building email verification links:\r\n\r\n InvalidArgumentError('Error while calling Auth service (TOO_MANY_ATTEMPTS_TRY_LATER).')\r\n\r\nIn both cases the original code is not introspectable in the exception, except by parsing the error string.","author":{"url":"https://github.com/skion","@type":"Person","name":"skion"},"datePublished":"2023-01-04T10:42:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/666/firebase-admin-python/issues/666"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7f68accf-760b-da1c-32e8-19c3a415d443 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA58:132892:432B14:559645:699054FC |
| html-safe-nonce | 940c445c6ff5cacdaba6a7bcecbd277a73e1da9e4b580c0e9298598113068ac4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTU4OjEzMjg5Mjo0MzJCMTQ6NTU5NjQ1OjY5OTA1NEZDIiwidmlzaXRvcl9pZCI6IjUzOTY0NDk2MzE4NzgwNjY4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c99388eda12749cbafdb7a37448e2e686a0d756f94a0b457f6176a5cc8129e04 |
| hovercard-subject-tag | issue:1518739449 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/firebase/firebase-admin-python/666/issue_layout |
| twitter:image | https://opengraph.githubassets.com/46bf20c94c8772bdf3cd19b2490952e40fe1480123c8c80d52f21afa013bd93b/firebase/firebase-admin-python/issues/666 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/46bf20c94c8772bdf3cd19b2490952e40fe1480123c8c80d52f21afa013bd93b/firebase/firebase-admin-python/issues/666 |
| og:image:alt | Is your feature request related to a problem? Please describe. When using the SDK to create email action links, such as for password reset or email verifications, Firebase is strongly rate limiting... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skion |
| hostname | github.com |
| expected-hostname | github.com |
| None | 42c603b9d642c4a9065a51770f75e5e27132fef0e858607f5c9cb7e422831a7b |
| turbo-cache-control | no-preview |
| go-import | github.com/firebase/firebase-admin-python git https://github.com/firebase/firebase-admin-python.git |
| octolytics-dimension-user_id | 1335026 |
| octolytics-dimension-user_login | firebase |
| octolytics-dimension-repository_id | 84979152 |
| octolytics-dimension-repository_nwo | firebase/firebase-admin-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 84979152 |
| octolytics-dimension-repository_network_root_nwo | firebase/firebase-admin-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3b33c5aedc9808f45bc5fcf0b1e4404cf749dac7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width