nextcloud-cookbook-flutter icon indicating copy to clipboard operation
nextcloud-cookbook-flutter copied to clipboard

Loading categories broken

Open nfuhler opened this issue 2 years ago • 23 comments

I am not able to use the app anymore. As soon as I open it, I am greeted with FormatException: Unexpected character (character 1)

^

Deleting all app data and logging back in changed nothing for me. The Cookbook Plugin on my Nextcloud is installed and working. I am using Nextcloud 20.0.13 with Cookbook version 0.9.4, app version 0.7.0 on Android 11

nfuhler avatar Oct 15 '21 16:10 nfuhler

Hello I'm sorry that it does no longer work.

First of all if you want to use the old version you can download the apk from the releases on github. This could help as a temporary solution.

To make sure : I assume it is broken since the update of the app. Is that korrekt?

I will check if I can reproduce this somehow but I am unsure if this is maybe even device specific :/ So device model would be good so i can check of I can at least emulate it!

Teifun2 avatar Oct 15 '21 17:10 Teifun2

I am getting the same thing. I am not sure when I upgraded, or when the error started. I think it was a while ago - just did not have time to do anything about it.

I have recently upgraded the server to php 8.

At log level 1 and 2 I do not get any errors in the nextcloud log. I do get an error with log level 0 - loads of errors similar to this:

{"reqId":"YWpKuZnVnQrF-sQX4sMfQgAAAAI","level":0,"time":"2021-10-16T03:44:57+00:00","remoteAddr":"10.0.0.227","user":"FCC09D37-38DB-4A88-A62B-D2D8394ECBBF","app":"files_texteditor","method":"GET","url":"/index.php/apps/cookbook/api/category/Sri%20Lankan","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Cookbook App","version":"22.2.0.2"}
{"reqId":"YWpKuU8Ukb5B6WC-5q-LpAAAABs","level":0,"time":"2021-10-16T03:44:57+00:00","remoteAddr":"10.0.0.227","user":"FCC09D37-38DB-4A88-A62B-D2D8394ECBBF","app":"files_texteditor","method":"GET","url":"/index.php/apps/cookbook/api/category/Salad","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Cookbook App","version":"22.2.0.2"}

dcrobertson01 avatar Oct 16 '21 04:10 dcrobertson01

@dcrobertson01 These seem to be deprecation logs. I looked a little bit into it and it seems to be an issue that would need to be fixed on the side of the actuall cookbook plugin, but it should not cause the issue here. (as far as i understood)

Teifun2 avatar Oct 16 '21 10:10 Teifun2

@Teifun2 That's the weird thing: It was broken and the I went and checked for updates in the PlayStore and the update to v0.7.0 wasn't installed. Installing it changed nothing. Just to be sure I installed v0.6.0 from GitHub and the error still persists. The database of my webhosting was recently upgraded to MySQL 8 from MySQL 5, I don't know if that has something to do with it. I get no new errors in the logs of my cloud besides the open basedir (https://github.com/nextcloud/server/issues/27759), which I think most of you would also get with the affected versions.

I am using a Xiaomi Redmi Note 8 Pro

nfuhler avatar Oct 16 '21 10:10 nfuhler

@nipfuh Oh so you mean is not connected to the app update. Hmm. In this case it seems to be more connected to the server that you are running, either version of nextlcloud / plugin / php / apache or any combination of those.

To debug this it would be easiest if you could send me a tester account on your nextcloud instance if that is an option.

Teifun2 avatar Oct 16 '21 10:10 Teifun2

I think I just found the solution: Somehow, a category without name got created. (It has been there for a longer time, up until now it has just been displayed with a * in the app) After I have moved the recipes from this unnamed category to one with a proper name, everything works again. Maybe @dcrobertson01 has the same issue?

I don't know, why or how that category was created, but it breaks the Nextcloud plugin as well. If you try to load recipes from that category or to (re)name it, the whole site crashes and needs to be closed.

Edit: You can manually recreate the issue when you edit the json file for a recipe and replace the value for recipeCategory with an empty string ("")

nfuhler avatar Oct 16 '21 11:10 nfuhler

Hi - will check the above, but there was an update to the server app, and updating seems to have fixed the problem.

dcrobertson01 avatar Oct 17 '21 05:10 dcrobertson01

I had the same issue, after updating to the latest App Version (Android App) fixed the problem

Cebrain avatar Oct 17 '21 16:10 Cebrain

@nipfuh Sorry that it took me so long to respond.

This is rather weird as it is expected behavior to some extend. If a recipe has no category it will be sent with empty string. The category should be displayed in the app with the * symbol. (So all recipes without a category)

Sadly i cannot reproduce this, and no one seems to currently have this issue so i will close this for now. if the issue persists or you have more information on how to reproduce i will gladly pick it up!

Teifun2 avatar Dec 18 '21 22:12 Teifun2

Thank you for a great app. I have loved to use it up until recently, when I started to run into this error a couple of weeks ago.

Screenshot_20221104-094627a I'm running v0.7.8 from the F-Droid app store on a Sony Xperia XZ1 Compact (G8441) with Android 9, the Nextcloud cookbook app is v0.9.13 on a hosted server from ocloud.de running Nextcloud version 20.0.13.

What I tried so far

  • logging out from the app and logging in again
  • looking for empty categories - none found
  • deleting the most recent recipes - no effect
  • deleting all recipes - no effect
  • downgrading the Android app from the F-Droid store - doesn't work, terminates with "unknown error"

Would love to get it going again soon!

ftjuh avatar Nov 04 '22 08:11 ftjuh

Hello @ftjuh

Im sorry to hear that you are havng trouble.

Would it be possible to create a test account on your instance and send me the credentials to [email protected]

This way i might be able to analyse the problem!

Teifun2 avatar Nov 04 '22 20:11 Teifun2

Would it be possible to create a test account on your instance and send me the credentials to [email protected] This way i might be able to analyse the problem!

Same problem here. Do you still need a test account?

m-fuchs avatar Nov 12 '22 17:11 m-fuchs

@m-fuchs What is the Cookbook version on your nextcloud instance? This points to a api incompatability with older versions.

Teifun2 avatar Nov 13 '22 10:11 Teifun2

@m-fuchs What is the Cookbook version on your nextcloud instance? This points to a api incompatability with older versions.

0.10.1

m-fuchs avatar Nov 13 '22 13:11 m-fuchs

I have made a test request on

https://$servername/$nextclouddirectory/index.php/apps/cookbook/api/v1/categories

I took this URL from /lib/src/services/categories_provider.dart.

I then get the correct JSON response:

[{"name":"Backen","recipe_count":3},{"name":"Kochen","recipe_count":2},{"name":"*","recipe_count":0}]

m-fuchs avatar Nov 13 '22 13:11 m-fuchs

Strange thing. Today I happened to look at the app and saw that everything was working again. Same version of the app and same version of Cookbook on the server.

From my point of view, everything is fine again.

m-fuchs avatar Nov 26 '22 09:11 m-fuchs

Sorry for being late in reporting back. I solved my above issue by downgrading to v0.7.6. As downgrading did not work from F-Droid, I had to uninstall and reinstall v0.7.6.

Since then, my hosted nextcloud instance was updated by my provider, which stopped v0.7.6 from working. I then upgraded to v0.7.8, again, and got it working again. So most probably my problem was caused by an old version of the cookbook app running on my server.

As a suggestions, would it be possible to implement a version check in the mobile app, so as to warn users if the server runs an outdated app version?

ftjuh avatar Nov 26 '22 22:11 ftjuh

Thank you for a great app. I have loved to use it up until recently, when I started to run into this error a couple of weeks ago.

Screenshot_20221104-094627a I'm running v0.7.8 from the F-Droid app store on a Sony Xperia XZ1 Compact (G8441) with Android 9, the Nextcloud cookbook app is v0.9.13 on a hosted server from ocloud.de running Nextcloud version 20.0.13.

I have the identical device (with a LineageOS running). Same server app version but Nextcloud in v23.0.11. I cannot make it work with v0.7.8 from F-Droid. v0.7.7 is loading no images in the overview and no recepies in detailled view. Downgrading to v0.7.6 was not possible. So I uninstalled and re-installed v0.7.6 and that is working. On my partners device the app runs smoothly with the server with the latest app version from google play store.

I'll be happy to do some debugging if someone tells me where to look.

donkeyDau avatar Dec 11 '22 20:12 donkeyDau

I've been getting the same error for a few months. Nextcloud Cookbook App: 0.9.13 Android Cookbook App (installed via F-Droid): 0.7.8 $INSTANCE/index.php/apps/cookbook/categories entered into a browser returns the following:

[{"name":"Aufstrich","recipe_count":"1"},{"name":"Ausprobieren","recipe_count":"9"},{"name":"Brot und Br\u00f6tchen","recipe_count":"14"},{"name":"Burger","recipe_count":"2"},{"name":"Curry","recipe_count":"3"},{"name":"Eintopf","recipe_count":"2"},{"name":"Fingerfood","recipe_count":"4"},{"name":"Gem\u00fcse","recipe_count":"3"},{"name":"Grillen","recipe_count":"1"},{"name":"Kuchen","recipe_count":"3"},{"name":"Lasagne und Auflauf","recipe_count":"2"},{"name":"Pasta","recipe_count":"2"},{"name":"Quesadillas","recipe_count":"1"},{"name":"Quiche","recipe_count":"1"},{"name":"Salat","recipe_count":"1"},{"name":"So\u00dfen","recipe_count":"1"},{"name":"Suppe","recipe_count":"3"},{"name":"S\u00fc\u00dfes","recipe_count":"2"},{"name":"Zwischenzutaten","recipe_count":"1"},{"name":"*","recipe_count":"0"}]

If I can help by providing any more information or test accounts, please let me know :-) Thanks for the great app!

lukashuebner avatar Dec 15 '22 14:12 lukashuebner

@lukashuebner example provides a JSON. But the error is complaining about an HTML file. Is this a redirect or something similar? I had the idea of a BOM or something similar but couldn't find anything on the login nor on the categories route.

donkeyDau avatar Dec 18 '22 20:12 donkeyDau

I entered the URL on my phone and got first the the login page and after login the JSON from above. So maybe something is broken with the login-state? Is there some way to getting the full HTML document the app seems to be receiving? Using Firefox Developer View on my computer in a logged in state, I see two network accesses: (1) the favicon (2) the above listed JSON. So there seems to be no redirect here.

As a sidenode: I found different URLs in some other issues, containing /api/ or /api/v1/. Those don't work for me, they redirect to the files overview. Are those outdated?

According to my Apache's access log, these seem to be the calls made by the Cookbook app:

$INSTANCE:443 $IP - lukas [19/Dec/2022:17:39:46 +0100] "GET //index.php/apps/cookbook/api/v1/categories HTTP/1.1" 302 6906 "-" "Dart/2.18 (dart:io)"
$INSTANCE:443 $IP - lukas [19/Dec/2022:17:39:46 +0100] "GET /index.php/apps/files/ HTTP/1.1" 200 12207 "-" "Dart/2.18 (dart:io)"
$INSTANCE:443 $IP - lukas [19/Dec/2022:17:39:47 +0100] "GET //index.php/apps/cookbook/api/version HTTP/1.1" 200 6813 "-" "Cookbook App"

So the Cookbook Android app seems to use other endpoints than the Cookbook web-app provides?

lukashuebner avatar Dec 19 '22 16:12 lukashuebner

This happens because the Cookbook API has changed. For example, in older versions, this was the call to get Categories: https://YOUR_SERVER/index.php/apps/cookbook/categories

but now the call is: https://YOUR_SERVER/index.php/apps/cookbook/api/v1/categories

This happens to a lot of different calls.

Best solution is to update Cookbook. I was on version 0.9.13 and the app was failing like others have explained in this thread. After update to 0.9.18, now the app works.

I had php 7.3 on my server and I needed to update to 7.4 because of Cookbook new version requirements. Also, I had to update Cookbook to 0.9.18 manually, because from the market only allows me to install 0.9.13.

I'm on Nextcloud 23.0.12

kereslas avatar Feb 04 '23 11:02 kereslas

Thank you, @kereslas! The Nextcloud Update Message was hiding behind “please upgrade to PHP 7.4”. I upgraded Debian, PHP, Nextcloud, and Cookbook, and it works now. :-)

lukashuebner avatar Feb 10 '23 09:02 lukashuebner