1nikolas / tidal-lyrics

Get the lyrics of what you're listening on Tidal
MIT License
41 stars 3 forks source link

Popup: JavaScript error popup: at endReadableNT (_stream_readable.js:1187:12) #7

Closed mlidbom closed 3 years ago

mlidbom commented 3 years ago

I've seen the below popup a couple of times now. Last time the window did not update lyrics after that until I restarted the app. Not sure if that always happens though. I don't remember needing to restart the app before.

[Window Title]
Error

[Main Instruction]
A JavaScript error occurred in the main process

[Content]
Uncaught Exception:
SyntaxError: Unexpected token
in JSON at position 16
    at JSON.parse (<anonymous>)
    at Request._callback (C:\Users\magnu\AppData\Local\tidal_lyrics\resources\app\src\index.js:331:34)
    at Request.self.callback (C:\Users\magnu\AppData\Local\tidal_lyrics\resources\app\node_modules\request\request.js:185:22)
    at Request.emit (events.js:310:20)
    at Request.<anonymous> (C:\Users\magnu\AppData\Local\tidal_lyrics\resources\app\node_modules\request\request.js:1154:10)
    at Request.emit (events.js:310:20)
    at IncomingMessage.<anonymous> (C:\Users\magnu\AppData\Local\tidal_lyrics\resources\app\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (events.js:416:28)
    at IncomingMessage.emit (events.js:322:22)
    at endReadableNT (_stream_readable.js:1187:12)
mlidbom commented 3 years ago

Ah, it's song related. This seems to cause it every time: https://tidal.com/browse/track/67803256 And the having to restart thing is not universal. I did not need to this time.

1nikolas commented 3 years ago

Really? It doesn't crash on me with that song.. Let me check the error

mlidbom commented 3 years ago

Neither does it for me. Now that is. At the time, every time I clicked the back button to go back to that track it did. No clue what changed, but apparently it is not the song, in and of itself, that causes the problem.....

1nikolas commented 3 years ago

The error is in this line https://github.com/1nikolas/tidal-lyrics/blob/d9511f81a2617b9b8b77c707661441cc50125e8d/src/index.js#L331 which means it has to do with the Musixmatch backend. It basically unescapes the musixmtach url taken from the page source and it fails to do that. So something weird happens in the musixmatch code. What I can do is make you a "debug" version where we could see what the exact problem is. So when it happens again, you would send me something from the log (you can open the log with a certain combination). But I'll do that later (I should probably add some stuff being logged on the release so it will be easier for future debugging)

1nikolas commented 3 years ago

Sorry for the delay. I just added the log functionality to the app. I'm uploading the build now

1nikolas commented 3 years ago

Here is the build.

https://www.dropbox.com/s/qvv5xffdl594zyy/tidal-lyrics-win32-ia32.zip?dl=0

The current log implementation is very basic and that means the log is saved only when you click "View Logs" from about. If you don't view the logs and close the app they get lost (otherwise they get saved in the default log folder: C:\Users\<username>\AppData\Roaming\tidal-lyrics\Electron\logs). I will fix that before releasing the new version. Anyway if this error occurs again, send the logs here (assuming the app is not frozen and you can click the about button). Also have you tried the refresh button when this happens? It should force refresh the lyrics

mlidbom commented 3 years ago

Thank you. Running that build now. I don't think I've tried the refresh button when this error occurred before. I will the next time :)

mlidbom commented 3 years ago

Here's a log from when the problem occurs. The Failing song is: "Hang with Me (Edit) - Robyn" First time it threw the exception, when I clicked close on the error display, the app redisplayed the lyrics for "Madonna - Borderline". When I re-caused the error by using the back button this did not happen again. Rather "Loading..." stays on the screen after I dismiss the javascript error prompt.

Hope this helps debug the problem :)

app.log

mlidbom commented 3 years ago

Oh, I forgot. Clicking the refresh button does nothing as far as I can tell. No new exception prompt. No lyrics display. Just keeps displaying "Loading..." Going to the next song everything seems to return to normal.

1nikolas commented 3 years ago

Okay I see the problem. Its songs with the word "edit". I know what causes the problem

1nikolas commented 3 years ago

So the error is very specific. It occurs only when the musixmatch link ends with "edit" (all lowercase). For some reason I cant find the exact version of the song you sent me but i found another song and the fix works

Old version image

New version image

1nikolas commented 3 years ago

I think its time for a new version. I'll release it today but it will take some time

mlidbom commented 3 years ago

Once again blazingly fast fix. Kudos! The reason you can't find the exact same song is most likely that we are in different countries and it is not available in your country.

Cheers :)