# Occasional 5xx errors from Auth0 JWKS endpoint

**URL:** <https://community.auth0.com/t/occasional-5xx-errors-from-auth0-jwks-endpoint/90160>\
**Category:** Get Help\
**Tags:** jwks, jwt, api, auth0\
**Created:** [September 7, 2022, 3:27pm UTC](https://community.auth0.com/t/occasional-5xx-errors-from-auth0-jwks-endpoint/90160 "2022-09-07T15:27:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anish1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/anish1/32/33385_2.png) [@anish1](https://community.auth0.com/u/anish1)\
**Post date:** [September 7, 2022, 3:27pm UTC](https://community.auth0.com/t/occasional-5xx-errors-from-auth0-jwks-endpoint/90160/1 "2022-09-07T15:27:30Z")

</div>

We have a backend with code similar to the [Python quickstart for Auth0](https://auth0.com/docs/quickstart/backend/python/01-authorization#create-the-jwt-validation-decorator) that fetches the JWKS from `"https://"+AUTH0_DOMAIN+"/.well-known/jwks.json"`. Last week, we were seeing ephemeral errors when hitting this endpoint, including:

- HTTP 500 (internal server error)
- HTTP 503 (service temporarily unavailable)
- An SSL handshake failure

Should we be worried about this? Was there some sort of Auth0 outage last week? Or do we need to build our code to be tolerant of this API endpoint being flaky?

We’ve started caching the JWKS (mostly to improve latency, to avoid having to fetch the JWKS for every request), and incidentally, we haven’t seen 5xx errors from this API endpoint since then, but I’m not sure if that’s just because we’re making fewer requests overall, and whether we’re going to run into the same issue, just after a longer period of time.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [October 8, 2022, 12:10am UTC](https://community.auth0.com/t/occasional-5xx-errors-from-auth0-jwks-endpoint/90160/3 "2022-10-08T00:10:07Z")

</div>

Hey there @anish1 welcome to the community!

Apologize for the delayed response but wanted to get to this one.

> [@anish1](#):
>
> Should we be worried about this? Was there some sort of Auth0 outage last week? Or do we need to build our code to be tolerant of this API endpoint being flaky?

I just did a bit of digging and am not seeing any outage around the time mentioned so I unfortunately don’t have an answer there.

> [@anish1](#):
>
> We’ve started caching the JWKS (mostly to improve latency, to avoid having to fetch the JWKS for every request), and incidentally, we haven’t seen 5xx errors from this API endpoint since then, but I’m not sure if that’s just because we’re making fewer requests overall, and whether we’re going to run into the same issue, just after a longer period of time.

I’m wondering if you were running into rate limits. Regardless, I’m happy to hear you’re no longer experiencing this after caching, which is the recommend approach. You can see in following code we default to 10 minutes in our auth0-Python:

> <https://github.com/auth0/auth0-python/blob/f15520b8390ee7ba131a2dc45b0f96591b96bd95/auth0/v3/authentication/token_verifier.py#L117>

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 22, 2022, 12:11am UTC](https://community.auth0.com/t/occasional-5xx-errors-from-auth0-jwks-endpoint/90160/4 "2022-10-22T00:11:02Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
