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

Handling MS Teams Rate Limit Request Failures #146

Open
Joooooooosh88 opened this issue May 24, 2023 · 1 comment
Open

Handling MS Teams Rate Limit Request Failures #146

Joooooooosh88 opened this issue May 24, 2023 · 1 comment
Labels

Comments

@Joooooooosh88
Copy link

Describe the bug
MS Teams rate limiting is not handled well and does not raise an exception. MS unfortunately chose to respond to rate limited requests with a 200 status code, only including the 429 error in the response body.
It would be fantastic if this library would raise a TeamsWebhookException if a 429 error is found in the response body, help avoid the trap I'm sure a lot of people fall into, assuming MS would pick sensible response codes.

To Reproduce
Steps to reproduce the behaviour:

  1. Trigger MS Teams webhook rate limit (default 4 requests/sec)
  2. Receive a 200 OK response but with a 429 error in the response body
  3. Standard request code raise_for_status or HTTP troubleshooting example, does not detect rate limiting, as it relies on status code
  4. Watch your application log 200's and leave you non-the-wiser

Expected behavior
MS choosing to respond with a 200 is unfortunate and non-sensical but something I'd hope a library like this would account for.

@zabojpetr
Copy link

It's not only Rate Limit, I got more errors for example:
Status: True
Response: <Response [200]>
Content: b'Webhook message delivery failed with error: Microsoft Teams endpoint returned HTTP error 500 with ContextId...'

Status: True
Response: <Response [200]>
Content: b'System.Net.Http.HttpRequestException: Error while copying content to a stream.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants