FoxxMD / multi-scrobbler

Scrobble plays from multiple sources to multiple clients
https://foxxmd.github.io/multi-scrobbler
MIT License
299 stars 14 forks source link

LastFM permission errors in log #115

Closed koehntopp closed 5 months ago

koehntopp commented 6 months ago

Please check the FAQ before submitting a bug report.

Describe the bug Hi,

I'm getting frequent permission errors (see below). Operation continues and recovers, but it would be nice to to get the error in the first place?

2023-12-10T23:09:20+01:00 info : [Scrobblers] [Listenbrainz - brainz] Scrobbled (Backlog) => (Lastfm) Trevor Horn - Swimming Pools (Drank) @ 2023-12-10T23:05:16+01:00 2023-12-10T23:09:15+01:00 info : [Sources] [Lastfm - myLastFm] Discovered => Trevor Horn - Swimming Pools (Drank) @ 2023-12-10T23:05:16+01:00 2023-12-10T14:47:11+01:00 warn : [API - Lastfm - myLastFm] API call was not good but recoverable (operation failed), retrying in 1.5 seconds... 2023-12-10T07:44:11+01:00 info : [Sources] [Lastfm - myLastFm] Polling started 2023-12-10T07:43:56+01:00 info : [Sources] [Lastfm - myLastFm] Poll retries (2) less than max poll retries (5), restarting polling after 15 second delay... 2023-12-10T07:43:56+01:00 error : [Sources] [Lastfm - myLastFm] Authentication Failed - You do not have permissions to access the service

To Reproduce Normal runtime behaviour

Expected behavior A clear and concise description of what you expected to happen.

Logs If possible reproduce the issue with debug logging ON


2023-12-10T07:43:56+01:00 error   : [Sources] [Lastfm - myLastFm] Authentication Failed - You do not have permissions to access the service
Error: 
    at CWD/node_modules/lastfm-node-client/lib/ApiRequest.js:136:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async u.callApi (CWD/build/server.js:1:16787)
    at async l.getRecentlyPlayed (CWD/build/server.js:12:5058)
    at async l.doPolling (CWD/build/server.js:9:14672)
    at async l.startPolling (CWD/build/server.js:9:12562)
    at async l.poll (CWD/build/server.js:9:12202)
2023-12-10T07:43:56+01:00 error   : [Sources] [Lastfm - myLastFm] Error occurred while polling
2023-12-10T07:43:47+01:00 error   : [Sources] [Lastfm - myLastFm] Authentication Failed - You do not have permissions to access the service
Error: 
    at CWD/node_modules/lastfm-node-client/lib/ApiRequest.js:136:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async u.callApi (CWD/build/server.js:1:16787)
    at async l.getRecentlyPlayed (CWD/build/server.js:12:5058)
    at async l.doPolling (CWD/build/server.js:9:14672)
    at async l.startPolling (CWD/build/server.js:9:12562)
    at async l.poll (CWD/build/server.js:9:12202)
2023-12-10T07:43:47+01:00 error   : [Sources] [Lastfm - myLastFm] Error occurred while polling```

**Versions (please complete the following information):**
Provide version information for any related sources/clients.

- multi-scrobbler: [e.g. 0.6.2 on docker]
FoxxMD commented 6 months ago

Is this still occurring? The error message you are seeing

Authentication Failed - You do not have permissions to access the service

Is directly from last.fm but is also probably the default message when they return a 403/401 status which could happen if they are having API issues upstream. They do tend to have API reliability issues more often than you'd expect. If MS recovers after some time then it's likely just that, a temporary upstream issue, rather than an actual issue with MS.

koehntopp commented 6 months ago

Yes, it's still occuring, and I also understand it's not a problem. I'm just suggesting the error message should be caught, and ignored if a retry is successful. Makes the log prettier ;)

FoxxMD commented 5 months ago

I'm not going to suppress 401/403 responses because it's important those fail fast for actual authentication issues. It's Last.fm's responsibility to return the correct HTTP response if they are having general availability issues from their side (and its not 401/403, its 5xx). In fact their rest spec specifies a list of known errors that multi-scrobbler already uses for retry logic, they just need to actually send them!

I've added additional checks to retry (and suppress errors) if the api call results in a general network issue (unreachable, dns, timeout, etc...). This won't stop logging 401/403 errors but it should cover all other cases.