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

Don't just log but also capture Keycloak exceptions during client creation #1644

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

Anahkiasen
Copy link
Contributor

@Anahkiasen Anahkiasen commented Jan 20, 2025

Fixed

  • Don't just log but also capture Keycloak exceptions during client creation

We seem to be throwing the Exception with the entire response from the API, so I don't think there is that much additional information to log that could help with the error in the screenshot since it seems Keycloak really is just returning "401 Unauthorized" without elaboration.

So this change should at least prevent Keycloak exceptions from not reaching Sentry, as currently they are caught and logged but not released back for capture by Sentry? This will hopefully provide us with a lot more metadata to understand what goes wrong.

Ticket: https://jira.publiq.be/browse/PPF-659

@LucWollants
Copy link
Contributor

LucWollants commented Jan 20, 2025

@Anahkiasen I guess we need to do this for all jobs because we don't report anything.

But I do wonder why the error method does not reach Sentry, because the default logging stack inside the Laravel logging config file has Sentry included.

@Anahkiasen
Copy link
Contributor Author

Anahkiasen commented Jan 20, 2025

Investigating whether the Sentry log client should also capture by default, the documentation say so but it doesn't seem to be the case, so perhaps it's an issue there, will do some local tests

EDIT: Seems to be when the exception is not present in the logging context which happens since we catch them and only log the message. Passing the exception in the context too allows it to be captured

@Anahkiasen Anahkiasen merged commit 664c1ef into main Jan 22, 2025
8 checks passed
@Anahkiasen Anahkiasen deleted the bugfix/PPF-659-missing-keycloak-logging branch January 22, 2025 14:15
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 this pull request may close these issues.

2 participants