-
Notifications
You must be signed in to change notification settings - Fork 327
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
When rate limited Retry-After
is not exposed
#5405
Comments
Retry-After
is not exposed
Hello! Please don't delete our issue template, we require users to follow it for a reason. Change your issue and fill it out completely and provide a minimal reproduction. |
There is no minimal repro it's just not part of the api while doc states it is. |
@safareli In this case having a sample of code where you'd expect to be able to access the value from the |
I think as a user of the js/ts api one could have this two expectations. one could even implement both it's up to you but here are what I would have expected and tried to look for.: try {
// or any other api call
await clerkClient.users.getUser(userId);
} catch (e) {
// option A
if (isClerkAPIResponseError(e) && e.status === 429) {
// I think at this point when status is 429 e should have the retry after property on it
// but it's probably more involved to type that way so maybe
e.retryAfter;
}
// option A.2
if (isClerkAPIResponseError(e) && e.retryAfter != null) {
e.retryAfter;
}
// option B
if(isClerkAPIResponseError(e)) {
const tooManyRequestsError = e.errors.find((_e) => _e.code === "too_many_requests")
if(tooManyRequestsError != null) {
tooManyRequestsError.retryAfter;
}
}
} |
from docs:
yet js api does not expose the
Retry-After
The text was updated successfully, but these errors were encountered: