Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App fails to load https://music.youtube.com with error #163

Open
jscheel opened this issue Apr 29, 2022 · 20 comments
Open

App fails to load https://music.youtube.com with error #163

jscheel opened this issue Apr 29, 2022 · 20 comments
Labels
bug Something isn't working

Comments

@jscheel
Copy link
Contributor

jscheel commented Apr 29, 2022

I've started getting a blank screen when opening the app. I built from source, enabled the inspector, and I'm seeing this error:

[Error] FetchEvent.respondWith received an error: TypeError: undefined is not an object (evaluating 'a.preloadResponse.then')
[Error] Cannot load https://music.youtube.com/.
[Error] Failed to load resource: FetchEvent.respondWith received an error: TypeError: undefined is not an object (evaluating 'a.preloadResponse.then') (music.youtube.com, line 0)

I can get it to go to any other page, including Youtube itself. But Youtube Music fails every time now.

@jscheel
Copy link
Contributor Author

jscheel commented Apr 29, 2022

Also getting this from the app's debugging:

[Process] 0x7fc67680b220 - [pageProxyID=5, webPageID=6, PID=7102] WebPageProxy::didFailProvisionalLoadForFrame: frameID=4, domain=WebKitServiceWorker, code=0

@jscheel
Copy link
Contributor Author

jscheel commented Apr 29, 2022

So, super weird, but I cleared all the data out before loading the web view via:

WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: Date(timeIntervalSince1970: 0), completionHandler: {})

and it loaded. However, nothing is playing.

@jscheel
Copy link
Contributor Author

jscheel commented Apr 29, 2022

It appears to be failing to load the player code:

Cannot load https://music.youtube.com/s/player/9cdfefcf/player_ias.vflset/en_US/base.js.

@evsasse
Copy link

evsasse commented Apr 29, 2022

and it loaded. However, nothing is playing.

Similar stuff happening to me. It was working fine until yesterday. But since this morning nothing is playing; while navigation/search/etc works fine.

@JuampiCarosi
Copy link

JuampiCarosi commented May 1, 2022

I'm having a similar issue, just downloaded from release tags and nothing is playing. I'm running big sur

@TimOliver
Copy link
Collaborator

Hrmmm. I also periodically open the app to a blank screen. Usually if I quit and re-open the app, it'll eventually start working again.

Thanks for the debug messages! I hadn't managed to capture any on my end. From those messages, do you think it's something on our end due to the custom JS we inject?

@TimOliver TimOliver added the bug Something isn't working label May 2, 2022
@jscheel
Copy link
Contributor Author

jscheel commented May 2, 2022

@TimOliver no, unfortunately it's not. This is caused by a bad service worker registration. The error that is throw is coming from the service worker trying to handle a prefetch of the file, and crashing because the fetch event doesn't support preloadResponse. Makes me think there's something wrong with the cache maybe. No clue how it could have possibly gotten into that state. However, I ended up unregistering the service worker and got it working again. Unfortunately, on the next load, it's broken again.

I found a bug report that looks like the issue here: https://developer.apple.com/forums/thread/702755. I tried the suggested solution (loading a different page first), but it seems to only work intermittently.

@jscheel
Copy link
Contributor Author

jscheel commented May 2, 2022

Ok, I have a possible solution. It's a hammer, but it seems to be working: I've set up a ContentRuleList in the WkWebView to prevent sw.js from loading. This prevents the service worker from registering, which in turn prevents the prefetching/caching of the code that seems to be broken for some reason. I need to clean up all my other test code to make sure this works consistently.

@jscheel
Copy link
Contributor Author

jscheel commented May 2, 2022

Added a PR for this

@mark-pictor-csec
Copy link

Not sure if it's related, but I just allowed an update to the latest version and now it won't play. Could be it's unrelated and it was already broken for me - this is the first time today I've tried it.

@TimOliver
Copy link
Collaborator

Thanks @jscheel! I've merged your PR and released a new update. It should download the next time you open the app.

@mark-pictor-csec Try opening the app and downloading the latest update, and see if the problem persists for you after that. :)

@evsasse
Copy link

evsasse commented May 3, 2022

No luck for me, same problem still happening. Updated it, uninstalled/reinstalled using brew, same behavior as before...

I see that someone created another similar issue, I will keep an eye there #165

@TimOliver
Copy link
Collaborator

@evsasse Uh. Whoops. Try downloading the release directly from GitHub and give that one a try. I haven't implemented automated releases to Brew yet. 😅

@evsasse
Copy link

evsasse commented May 3, 2022

I haven't implemented automated releases to Brew yet. 😅

But the "Check for updates" works, right? I am able to get 1.3.2, even though I installed with brew originally 👍.

Try downloading the release directly from GitHub and give that one a try.

Uninstalled from brew, and tried that just now... Still no luck :/

Navigation/search/etc works fine. But when I click to start playing something, it keeps loading forever, doesnt show the "bar" at the bottom.

Screen Shot 2022-05-03 at 10 28 23

@mark-pictor-csec
Copy link

I was able to update to 1.3.2 from within the app, but I still can't play music.

@jscheel
Copy link
Contributor Author

jscheel commented May 3, 2022 via email

@jscheel
Copy link
Contributor Author

jscheel commented May 4, 2022

Ok @TimOliver, I've added a new PR for unregistering service workers

@evsasse
Copy link

evsasse commented May 6, 2022

1.3.3 seems to have fixed it for me. Thanks @jscheel @TimOliver 🙇!

@Raheemshah2809
Copy link

Should Close this no, as I don't see this anymore as well

@targyll
Copy link

targyll commented Feb 19, 2023

I have just discovered this app (v1.3.3). It is not working here (10.13.6), I have a blank screen and nothing more...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants