kcal-app / kcal

the personal food nutrition journal
Mozilla Public License 2.0
295 stars 27 forks source link

Recipes api returns 500 error. Other queries seem fine. #55

Closed TheHairyGun closed 11 months ago

TheHairyGun commented 11 months ago

192.168.1.102 - - [28/Sep/2023:18:58:10 +0000] "GET /api/v1/foods?page[number]=1&page[size]=12 HTTP/1.1" 200 11706 "http://192.168.1.238/foods" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" 192.168.1.102 - - [28/Sep/2023:18:58:13 +0000] "GET /recipes HTTP/1.1" 200 15598 "http://192.168.1.238/foods" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0" 192.168.1.102 - - [28/Sep/2023:18:58:13 +0000] "GET /api/v1/recipes?page[number]=1&page[size]=12 HTTP/1.1" 500 6628 "http://192.168.1.238/recipes" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0"

Navigation seems to be fine; however, the api is returning 500 causing recipes page to spool endlessly. Trying to dig up more details, but I'm just now diggin in.

Restarting host & containers doesn't seem to resolve.

Host details: Operating System: Ubuntu 20.04.5 LTS Kernel: Linux 5.4.0-163-generic Architecture: x86-64

Appreciate any help!

TheHairyGun commented 11 months ago

I fixed this by deleting the last entry within my recipes database. Not sure what the issue was beyond that, but after some fiddling around I think it might be related to a bad "food" item, so you might need to recreate items which you've used in that recipe.

Command sequence for anyone who experiences this looks roughly like this...

// connect to the docker db instance $ ssh dockerhost@ $ mysql -u kcal -h 127.0.0.1 -P 3306 -p

// use mysql to delete the problematic entry

use kcal select * FROM recipes delete FROM recipes WHERE id=5;