memen45 / SubMusic

Sync music and podcasts to your Garmin watch from your own SubSonic or Ampache server
GNU General Public License v3.0
122 stars 13 forks source link

Test Server fails but Subsonic works fine otherwise #65

Closed qudiqudi closed 1 year ago

qudiqudi commented 1 year ago

Nextcloud 25.0.2 Garmin Forerunner 945 LTE latest update Subsonic 0.2.7

Test Server gives INVALID_HTTP_BODY_IN_NETWORK_RESPONSE after "Inlog Ok" message. Server is accessed only via https:// with a valid cert.

Settings according to Readme in the "nextcloud" section. I already reinstalled the nextcloud music app and the Garmin-IQ Subsonic app, also tried multiple username - pw combos.

memen45 commented 1 year ago

Can you get any logs? I haven't updated Nextcloud yet, so I am not sure if there is a problem with the 25 version. Do you use subsonic or ampache backend? Did you use the correct url accordingly?

qudiqudi commented 1 year ago

Here is the log from when I use "Test Server" on the watch.

[index] Fehler: Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing a query: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "artist_name" does not exist
LINE 12: ...E "oc_music_tracks"."user_id" = $1 ORDER BY LOWER("artist_na...
                                                              ^ at <<closure>>

 0. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1780
    Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert(Doctrine\DBAL\Driver\PDO\Exception {}, Doctrine\DBAL\Query {})
 1. /var/www/html/3rdparty/doctrine/dbal/src/Connection.php line 1719
    Doctrine\DBAL\Connection->handleDriverException(Doctrine\DBAL\Driver\PDO\Exception {}, Doctrine\DBAL\Query {})
 2. /var/www/html/3rdparty/doctrine/dbal/src/Statement.php line 193
    Doctrine\DBAL\Connection->convertExceptionDuringQuery(Doctrine\DBAL\Driver\PDO\Exception {}, "SELECT \"oc_mus ... 0", ["USERNAME_REDACTED"], [2])
 3. /var/www/html/lib/private/DB/PreparedStatement.php line 87
    Doctrine\DBAL\Statement->execute(null)
 4. /var/www/html/lib/public/AppFramework/Db/Mapper.php line 252
    OC\DB\PreparedStatement->execute()
 5. /var/www/html/lib/public/AppFramework/Db/Mapper.php line 340
    OCP\AppFramework\Db\Mapper->execute("SELECT `*PREFIX ... )", ["USERNAME_REDACTED"], 20, 0)
 6. /var/www/html/custom_apps/music/lib/Db/BaseMapper.php line 101
    OCP\AppFramework\Db\Mapper->findEntities("SELECT `*PREFIX ... )", ["USERNAME_REDACTED"], 20, 0)
 7. /var/www/html/custom_apps/music/lib/AppFramework/BusinessLayer/BusinessLayer.php line 160
    OCA\Music\Db\BaseMapper->findAll("USERNAME_REDACTED", 2, 20, 0, null, null, null, null)
 8. /var/www/html/custom_apps/music/lib/Controller/AmpacheController.php line 477
    OCA\Music\AppFramework\BusinessLayer\BusinessLayer->findAll("USERNAME_REDACTED", 2, 20, 0)
 9. /var/www/html/custom_apps/music/lib/Controller/AmpacheController.php line 196
    OCA\Music\Controller\AmpacheController->playlist_songs("1190a1bf2f9a4a85257d980ceafcc3f6", 10000000, 20, 0)
10. /var/www/html/custom_apps/music/lib/Controller/AmpacheController.php line 168
    OCA\Music\Controller\AmpacheController->dispatch("playlist_songs")
11. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Music\Controller\AmpacheController->jsonApi("playlist_songs")
12. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController(OCA\Music\Controller\AmpacheController {}, "jsonApi")
13. /var/www/html/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch(OCA\Music\Controller\AmpacheController {}, "jsonApi")
14. /var/www/html/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main("AmpacheController", "jsonApi", OC\AppFramework\ ... {}, ["music.ampache.jsonApi"])
15. /var/www/html/lib/base.php line 1047
    OC\Route\Router->match("/apps/music/amp ... p")
16. /var/www/html/index.php line 36
    OC::handleRequest()

GET /apps/music/ampache/server/json.server.php?filter=10000000&offset=0&auth=1190a1bf2f9a4a85257d980ceafcc3f6&limit=20&action=playlist_songs
from IP_REDACTED at 2023-01-02T22:02:24+01:00

I use ampache backend with the correct url. Maybe important to note that I use nextcloud with postgresql.

memen45 commented 1 year ago

The error mentions missing column name "artist_name". I don't think SubMusic does any request particularly related to this column, so I would expect a database problem on the server side. Since you mention you use a different sql, are you sure all the database tables are initialized properly?

What version of the music app do you use? Could you log the response contents as well?

qudiqudi commented 1 year ago

I can say that the music app works wonderfully. I just re-read the music library just to be sure, still the same error when using Test Server. But now comes the catch. I didn't try to actually download something onto the watch - I immediately stopped trying when the server test failed. Turns out: Subsonic works perfectly fine. I can fetch podcast and music and download them.

So I'd say there is some improvement needed to the server test routine...maybe some conditions changed for postgres..? If you need anything, I'll help gladly.

memen45 commented 1 year ago

Server errors return plain html instead of json. The watch will give the -400 error if the response is not json.

Can you reproduce the error by going to the SubMusic menu, More... >> Browse >> Playlists >> choose the first playlist >> Songs?

That should do the same request I believe.

Otherwise, can you try and copy the request in your browser, then see if you get the Nextcloud server error page.

qudiqudi commented 1 year ago

Can you reproduce the error by going to the SubMusic menu, More... >> Browse >> Playlists >> choose the first playlist >> Songs?

This works perfectly well. Playlist returns the songs and no errors in the nc logs. And suddenly the test returns "Test succeeded". Seems that I had to first fetch songs and podcast to finalize the test...

qudiqudi commented 1 year ago

I'll close this, as there is no longer an issue. Thanks for your help!