kellnerd / harmony

Music Metadata Aggregator and MusicBrainz Importer
MIT License
55 stars 7 forks source link

SyntaxError: Unexpected end of JSON input #47

Closed kellnerd closed 2 weeks ago

kellnerd commented 5 months ago

The Tidal API seems to return invalid JSON occasionally.

Unfortunately the logs don't contain the release lookup URL if only a single provider failed (error is currently handled in a place where we don't have access to that information), but here are some extracts of log lines which are likely correlated and might give a hint (although a Tidal lookup for that barcode works for me currently):

Jun 23 03:37:21 harmony deno[103430]: harmony.lookup [INFO] Beatport: Search returned no matching results
Jun 23 03:37:23 harmony deno[103430]: harmony.lookup [INFO] iTunes: API returned no results: https://itunes.apple.com/lookup?entity=song&limit=200&upc=5063381083869&country=jp
Jun 23 03:37:23 harmony deno[103430]: harmony.lookup [ERROR] SyntaxError: Unexpected end of JSON input
Jun 23 03:37:23 harmony deno[103430]:     at parse (<anonymous>)
Jun 23 03:37:23 harmony deno[103430]:     at packageData (ext:deno_fetch/22_body.js:370:14)
Jun 23 03:37:23 harmony deno[103430]:     at consumeBody (ext:deno_fetch/22_body.js:247:12)
Jun 23 03:37:23 harmony deno[103430]:     at eventLoopTick (ext:core/01_core.js:168:7)
Jun 23 03:37:23 harmony deno[103430]:     at async TidalProvider.query (file:///home/harmony/harmony/providers/Tidal/mod.ts:99:21)
Jun 23 03:37:23 harmony deno[103430]:     at async TidalReleaseLookup.getRawTracklist (file:///home/harmony/harmony/providers/Tidal/mod.ts:191:66)
Jun 23 03:37:23 harmony deno[103430]:     at async TidalReleaseLookup.convertRawRelease (file:///home/harmony/harmony/providers/Tidal/mod.ts:209:24)
Jun 23 03:37:23 harmony deno[103430]:     at async TidalReleaseLookup.getRelease (file:///home/harmony/harmony/providers/base.ts:290:19)
Jun 23 03:37:23 harmony deno[103430]:     at async Function.allSettled (<anonymous>)
Jun 23 03:37:23 harmony deno[103430]:     at async CombinedReleaseLookup.getProviderReleaseMapping (file:///home/harmony/harmony/lookup.ts:184:26)
Jun 23 03:37:23 harmony deno[103430]: harmony.lookup [INFO] Beatport: Search returned no matching results

If someone wants to work on this and needs more log samples, just let me know.

kellnerd commented 2 weeks ago

Looks like the JSON parsing error is hiding the real error... That part should be fixed in https://github.com/kellnerd/harmony/commit/736d6eb912dc6b2cb7a07cf30619436b1bc6c24d, let's see which error message we get instead.