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

Figure out how to keep health check calls to /docs from spamming the logs #33

Closed
jcadam14 opened this issue Apr 25, 2024 · 3 comments · Fixed by #35
Closed

Figure out how to keep health check calls to /docs from spamming the logs #33

jcadam14 opened this issue Apr 25, 2024 · 3 comments · Fixed by #35
Assignees

Comments

@jcadam14
Copy link
Contributor

The health checks for our container calls the /docs endpoint. But because we setup FastAPI with oauth2 backend, the checks fail with the following log entries:

INFO:     [25-04-2024 16:17:34] 127.0.0.1:54476 - "GET /docs HTTP/1.1" 200 OK
ERROR [regtech_api_commons.oauth2.oauth2_backend] failed to get claims
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/regtech_api_commons/oauth2/oauth2_backend.py", line 27, in authenticate
    token = await self.token_bearer(conn)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/fastapi/security/oauth2.py", line 588, in __call__
    raise HTTPException(
fastapi.exceptions.HTTPException: 401: Not authenticated

Figure out a way to allow the check to continue to respond so the container knows it's healthy, but not spam the logs with these 401 errors.

@hkeeler
Copy link
Member

hkeeler commented Apr 25, 2024

Can we just not have /docs require auth? Doesn't seem like it should anyway.

@jcadam14
Copy link
Contributor Author

Can we just not have /docs require auth? Doesn't seem like it should anyway.

The odd thing is the call to /docs gets a 200, so it seems like it isn't authenticating on that url. And the /docs in the cluster doesn't require you to be authenticated. However, after every call to it, you get that oauth2_backend exception, and I'm not sure why. Those exceptions always go hand in hand with the /docs, every 10 seconds.

@hkeeler
Copy link
Member

hkeeler commented Apr 25, 2024

Gotcha. That is odd.

@jcadam14 jcadam14 self-assigned this Apr 29, 2024
@jcadam14 jcadam14 transferred this issue from cfpb/sbl-filing-api Apr 29, 2024
@jcadam14 jcadam14 linked a pull request Apr 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants