Summary: | Better logging of 500 errors in V1/Auth.pm | ||
---|---|---|---|
Product: | Koha | Reporter: | Kyle M Hall (khall) <kyle> |
Component: | REST API | Assignee: | Kyle M Hall (khall) <kyle> |
Status: | Pushed to oldstable --- | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | normal | ||
Priority: | P5 - low | CC: | fridolin.somers, lucas, m.de.rooy, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36420 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
24.05.00,23.11.06,23.05.12
|
|
Circulation function: | |||
Attachments: |
Bug 36421: REST API 500 errors say to check the logs, but suppress errors that would be there
Bug 36421: Make sure pre-controller errors are correctly logged Bug 36421: Make sure pre-controller errors are correctly logged Bug 36421: Make sure pre-controller errors are correctly logged |
Description
Kyle M Hall (khall)
2024-03-25 18:41:25 UTC
Created attachment 163856 [details] [review] Bug 36421: REST API 500 errors say to check the logs, but suppress errors that would be there If a REST auth error happens that that is unblessed or uncaught, we should warn the value to the logs. Test Plan: 1) Install the curbside pickups plugin 2) create a patron with the userid 'puser' and the cardnumber 'pcard' 3) GET /api/v1/contrib/curbsidepickup/patrons/XXX/pickups using basic auth with the username 'pcard' where XXX is the patron borrowernumber 4) Note there is no error in the logs 5) Apply this patch 6) Repeat step 3 7) You should now see an error in the logs! I noticed a bug in the basic Auth code that makes it easy to highlight this issue. If you don't mind, Kyle, I'll provide an alternate patch for this. Created attachment 163994 [details] [review] Bug 36421: Make sure pre-controller errors are correctly logged If something explodes in Koha::REST::V1::Auth chances are that no logging will happen. This patch makes sure they are! To test: 1. Make sure you do NOT have 36420 on your tree 2. Make sure you are looking at the logs: $ ktd --shell k$ koha-plack --restart kohadev; tail -f /var/log/koha/kohadev/*.log 3. Use Postman or similar for hitting some known endpoint. Use the user's cardnumber instead of the userid. On a default KTD launch, the generated user's cardnumber is '42'. GET /patrons => FAIL: You get a 500 error (expected, fixed on 36420) but no useful logging found. 4. Apply this patch 5. Ctrl+c on the logs and re-run the command 6. Repeat 3 => SUCCESS: You get a 500, but you also get the exception information logged! 7. Sign off :-D Created attachment 163995 [details] [review] Bug 36421: Make sure pre-controller errors are correctly logged If something explodes in Koha::REST::V1::Auth chances are that no logging will happen. This patch makes sure they are! To test: 1. Make sure you do NOT have 36420 on your tree 2. Make sure you are looking at the logs: $ ktd --shell k$ koha-plack --restart kohadev; tail -f /var/log/koha/kohadev/*.log 3. Use Postman or similar for hitting some known endpoint. Use the user's cardnumber instead of the userid. On a default KTD launch, the generated user's cardnumber is '42'. GET /patrons => FAIL: You get a 500 error (expected, fixed on 36420) but no useful logging found. 4. Apply this patch 5. Ctrl+c on the logs and re-run the command 6. Repeat 3 => SUCCESS: You get a 500, but you also get the exception information logged! 7. Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Created attachment 164117 [details] [review] Bug 36421: Make sure pre-controller errors are correctly logged If something explodes in Koha::REST::V1::Auth chances are that no logging will happen. This patch makes sure they are! To test: 1. Make sure you do NOT have 36420 on your tree 2. Make sure you are looking at the logs: $ ktd --shell k$ koha-plack --restart kohadev; tail -f /var/log/koha/kohadev/*.log 3. Use Postman or similar for hitting some known endpoint. Use the user's cardnumber instead of the userid. On a default KTD launch, the generated user's cardnumber is '42'. GET /patrons => FAIL: You get a 500 error (expected, fixed on 36420) but no useful logging found. 4. Apply this patch 5. Ctrl+c on the logs and re-run the command 6. Repeat 3 => SUCCESS: You get a 500, but you also get the exception information logged! 7. Sign off :-D Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> [OK] prove t/db_dependent/api/v1/items.t t/db_dependent/api/v1/unhandled_exceptions.t Pushed for 24.05! Well done everyone, thank you! Pushed to 23.11.x for 23.11.06 Backported to 23.05.x for upcoming 23.05.12 |