question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rate limit headers not attached to error object

See original GitHub issue

I am finding when i hit the twitter “friends/ids” endpoint 16 times the expected { errors: [ { message: 'Rate limit exceeded', code: 88 } ] is thrown but does not contain _headers.

I am hoping to use e._headers[“x-rate-limit-reset”] to tell me when to continue my job as indicated in the documentation. (https://github.com/draftbit/twitter-lite/blob/master/README.md#api-errors)

I think it was broken in this merge: https://github.com/draftbit/twitter-lite/pull/75/files

By this line not throwing the json object & headers https://github.com/draftbit/twitter-lite/blob/b19263b1ce5afd7617583672575d317ad31acfc8/twitter.js#L100

If I can get your tests to run ill raise a PR and write a test.

Can i introduce Nock rather than actually hitting the twitter API to simulate these conditions?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
paulmarscommented, May 16, 2020

0.9.4 appears to work so far

0reactions
kmaidcommented, May 19, 2020

This has resolved my issue. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

API host's rate-limit header not read properly - Stack Overflow
The server needs to send the Access-Control-Expose-Headers: x-ratelimit alongside the x-ratelimit: somevalue to allow a cors client to read the ...
Read more >
Rate limit best practices - Okta Developer
This example shows the relevant portion of a rate limit header being returned with an error for a request that exceeded the concurrent...
Read more >
400 errors and x-rate-limit and x-rate-limit-remaining undefined
I would expect the x-rate-limit-remaining header to be 0 and the body to contain an “errors” attribute, telling us that we reached our...
Read more >
Rate Limiting | Sentry Developer Documentation
Rate limits are communicated to SDKs via status codes and response headers. For regular rate limit responses, we emit a 429 status code...
Read more >
Adjusting your code for rate limiting - Atlassian Documentation
Active: Make requests and observe all response headers. · Adjust: With every request, recalculate the rate based on the following headers: · Retry ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found