BLeeEZ / amperfy

Amperfy is an iOS app to play songs from an Ampache or Subsonic server
GNU General Public License v3.0
383 stars 34 forks source link

Errors thrown in the Nextcloud log when using Amperfy with Nextcloud Music via Subsonic #233

Closed Anvil5465 closed 2 months ago

Anvil5465 commented 3 months ago

These errors silently appear in the Nextcloud log, but as far as I can tell everything seems to work fine. The errors don't appear when using the Ultrasonic client. See some examples below:

[PHP] Error: Undefined array key "" at /var/www/html/lib/private/AppFramework/Http.php#128
    GET /index.php/apps/music/subsonic/rest/search3.view?u=[username]&v=1.11.0&c=Amperfy&p=Wqx6MEPhzyuE&query=1%20step&artistCount=40&artistOffset=0&albumCount=0&albumOffset=0&songCount=0&songOffset=0
    from [client ip address] by -- at Mar 23, 2024, 2:04:22 PM
[PHP] Error: Undefined array key "" at /var/www/html/lib/private/AppFramework/Http.php#128
    GET /index.php/apps/music/subsonic/rest/getPodcasts.view?u=[username]&v=1.11.0&c=Amperfy&p=Wqx6MEPhzyuE&includeEpisodes=false
    from [client ip address] by -- at Mar 23, 2024, 2:51:10 PM
[PHP] Error: Undefined array key "" at /var/www/html/lib/private/AppFramework/Http.php#128
    GET /index.php/apps/music/subsonic/rest/getAlbum.view?u=[username]&v=1.11.0&c=Amperfy&p=Wqx6MEPhzyuE&id=album-1016
    from [client ip address] by -- at Mar 23, 2024, 1:41:27 PM

While these errors have no effect on the user experience of the person using Amperfy, they are a bit of a nuisance for the server administrator, as they quickly fill up the log with several errors per minute.

BLeeEZ commented 2 months ago

Hi, from my point of view these requests look good. Thank you for reporting them nevertheless.

Anvil5465 commented 2 months ago

Thank you for the reply. I'm not a developer so I don't know how feasible this is, but do you think there's anything that can be done to reduce the number of requests that are classified as errors? The issue is I get thousands of them every week and it makes it harder to find errors for actual problems.

Alternatively, is this something I should report on the nextcloud music github instead?

BLeeEZ commented 2 months ago

From my point of view should this be a server problem. getAlbum.view is one of the easiest request and the url displayed in log correct. [PHP] Error: Undefined array key "" at /var/www/html/lib/private/AppFramework/Http.php#128 It looks to me like an internal server problem.

BLeeEZ commented 2 months ago

After some further investigation I found something in my Subsonic API implementation. When the App starts it first requests the server with a ping request to get the supported Subsonic API version back from the server. Based on that version Amperfy decides wich authentication method should be used. This ping request without authentication parameters can result in error messages on the server. I changed that behaviour in a5ed97b98094f962edf60ca1f1b2ed1cd448ccb2. So now if you decided to select "Legacy Subsonic" on the Login Screen then always clear password auth will be used and for "Subsonic" always token based auth will be used. This should fix the error messages on server side.

BLeeEZ commented 2 months ago

It can be tested via TestFlight in version 1.2.0 (3).

Anvil5465 commented 2 months ago

Unfortunately, it appears that Nextcloud Music only supports plain text passwords at the moment so the new authentication method does not work for me, but Nextcloud Music implemented a fix for the errors on their end, so my issue is resolved.