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

SIMSBIOHUB-600: Handle Keycloak Auto-Renew Error, Write Logs to File #1342

Merged
merged 12 commits into from
Aug 21, 2024

Conversation

NickPhura
Copy link
Collaborator

@NickPhura NickPhura commented Aug 16, 2024

Links to Jira Tickets

https://apps.nrs.gov.bc.ca/int/jira/browse/SIMSBIOHUB-600

Description of Changes

Keycloak login infinite loop

  • Add signout when keycloak silent renew fails.
  • Explicitly declare the automaticSilentRenew flag in the authConfig. This is on by default, but declaring to make it more visible.

Console log size

  • Add new transport to winston logger to write logs to file(s)

    • For non-production builds: Continues to write to the console (as well as the files)
  • Add new env vars for managing the log settings of the file transport

  • Add PVC config to api deploy yaml (for storing logs)

Other

  • Remove deprecated comment from useAxios.ts

Testing Notes

Tested this by logging into SIMS in 2 different tabs, and then logging out of one of the tabs.
When the other tab tries to refresh the token, it fails, because the token has already been revoked, and immediately redirects the user to the home page. Watched it happen live, and it all happens quickly and without any weird UI interactions or anything.

Explicitly declare the automaticSilentRenew flag in the authConfig.
Remove deprecated comment from useAxios.ts
@NickPhura NickPhura changed the title SIMSBIOHUB-600: Handle keycloak refresh error SIMSBIOHUB-600: Handle Keycloak Auto-Renew Error Aug 16, 2024
Copy link

codecov bot commented Aug 17, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 47.92%. Comparing base (d50c70f) to head (5b637cc).
Report is 1 commits behind head on dev.

Files Patch % Lines
api/src/utils/logger.ts 85.71% 0 Missing and 3 partials ⚠️
api/src/paths/logger.ts 60.00% 0 Missing and 2 partials ⚠️
app/src/contexts/authStateContext.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1342      +/-   ##
==========================================
+ Coverage   47.89%   47.92%   +0.02%     
==========================================
  Files         737      737              
  Lines       20007    20027      +20     
  Branches     3137     3146       +9     
==========================================
+ Hits         9582     9597      +15     
- Misses       9823     9825       +2     
- Partials      602      605       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NickPhura NickPhura changed the title SIMSBIOHUB-600: Handle Keycloak Auto-Renew Error SIMSBIOHUB-600: Handle Keycloak Auto-Renew Error, Write Logs to File Aug 19, 2024
@NickPhura NickPhura added the Ready For Review PR is ready for review label Aug 21, 2024
api/src/utils/logger.ts Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Aug 21, 2024

Copy link
Collaborator

@mauberti-bc mauberti-bc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and looks good 👍

@mauberti-bc mauberti-bc merged commit 1162ce1 into dev Aug 21, 2024
22 checks passed
@mauberti-bc mauberti-bc deleted the SIMSBIOHUB-600 branch August 21, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants