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

AmpacheError::405 when syncing #93

Closed haelduksf closed 7 months ago

haelduksf commented 9 months ago

My setup: Ampache 6.2.1 (in a docker container) nginx https proxy Vivoactive 5

Server test stalls at 75%, screen showing "Inlog OK No podcasts" I'm able to pull playlists and list the songs in the playlists, but the sync always fails with "AmpacheError::405"

I've tried falling back to the subsonic API but that doesn't work either- I get HttpError::500

As far as I can tell, the server is working fine. I'm using DSub on my phone and haven't experienced any issues. I'm happy to share the server location & provide testing credentials via DM.

memen45 commented 9 months ago

HttpError::500 would indicate a server side error.

AmpacheError::405 would indicate an API call is not implemented by Ampache. However, as the server version is sent with each request, the server should use the correct Ampache API version and there haven't been any changes on the side of SubMusic.

If you want me to check your server while debugging, you can send me a message through the 'Contact Developer' option on the Connect IQ app store page for SubMusic. Always happy to help!

haelduksf commented 9 months ago

I think I solved this one actually. While I was troubleshooting earlier, I synced some playlists from another server to see if they'd work. When I changed the config to point to my own server, I left those playlists selected. Once I deselected them, the sync started working. Might be worth checking to see if the playlist exists before attempting to sync it, but I guess if I'm the first one to run into this, it's not a common problem.

memen45 commented 9 months ago

If the playlist is not available, Ampache should return a 404 not found. If that is not the case, there might be a server problem with the Ampache 6.2.1 version.

IIRC SubMusic will handle a 404 not found and continue to the next playlist.

memen45 commented 9 months ago

https://github.com/memen45/SubMusic/blob/master/source%2FSync%2FPlaylistSync.mc#L93

Here 404 HttpError and 404 AmpacheError is handled. All other API or HTTP errors will lead to an aborted sync indeed.

Are you able to replicate the issue

If you are able to reproduce, we can create an issue at the Ampache repository to resolve the issue!

Thanks a lot for your feedback!

haelduksf commented 9 months ago

Sorry, busy week for me, but I'll try to run that test this weekend!

haelduksf commented 9 months ago

I was able to reproduce the AmpacheError::405 by creating a 1-song playlist, turning on sync for that playlist, syncing, deleting it, then syncing again.

memen45 commented 9 months ago

Great! Then Ampache is returning an incorrect error. It should return 404.

Do you happen to have server logs available to see exactly which request is returning the 405?

haelduksf commented 8 months ago

I do have the logs but I don't see any 405s. I wonder if it's coming from some intermediate step. Is there an easy way for me to pull the debug log from my watch to get more details?

memen45 commented 8 months ago

Are you sure you have the correct logs? Apache will return HTTP 200 with json content in which the error code is included. So if you only have access logs, you will indeed see only HTTP 200 responses.

lachlan-00 commented 7 months ago

the errors are something in the method.

it's catching an error image

and then returning the error as 405 image

something for me to fix, not submusic

lachlan-00 commented 7 months ago

set with acf09d7d022401108d86df21043d52270ef2a3c3 to fix up those errors

lachlan-00 commented 7 months ago

I've put in optional debugging for the api handler which will break and throw exceptions in the classes and lines so it's easier to identify

https://github.com/ampache/ampache/commit/392b1869de27631ebee7234b913f6c3faeed5515

memen45 commented 7 months ago

Closing this issue as it is addressed in Ampache/Ampache repository. Thanks for your feedback!