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

Loading of Bazarr page failed (blank page) #1822

Closed
derycklong opened this issue May 1, 2022 · 28 comments
Closed

Loading of Bazarr page failed (blank page) #1822

derycklong opened this issue May 1, 2022 · 28 comments

Comments

@derycklong
Copy link

Its been a while since I visited Bazaar. When I tried to load the page. it does not seems to load and when I inspect element, I got the error below.

Loading module from “http://localhost:6767/assets/index.c6b646f7.js” was blocked because of a disallowed MIME type (“text/plain”).
[localhost:6767]
Loading failed for the module with source “http://localhost:6767/assets/index.c6b646f7.js”.

@morpheus65535
Copy link
Owner

Try to clear your browser cache or use another browser.

@jvvilar
Copy link

jvvilar commented May 1, 2022

Adding my report for this exact issue. Attempted Chrome, Edge, Opera and Firefox. Attempted clear browser with no addons.

Firefox:
Loading module from “https://***/assets/index.c6b646f7.js” was blocked because of a disallowed MIME type (“text/plain”).

Others:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

Edit: After a bit of searching, it seems related to the way windows incorrectly maps .js filetypes. I saw some tips about importing mimetypes.py and setting the content type for .js but since I'm not a python developer, I wouldn't know where to start.
Also, why this would happen literally over night without any updates to windows or anything, is beyond me.

Edit2: Because I can't stop digging, I found a "solution" that worked for me. Take it for what it is. Using regedit to navigate to
[HKEY_CLASSES_ROOT.js]
I changed
"Content Type"="text/plain"
to
"Content Type"="text/javascript"
After that, I noticed Bazarr has a 10 minute cache, so a reboot and a few minutes later it worked fine on localhost and externally after nuking my Cloudflare cache.

@morpheus65535
Copy link
Owner

@LASER-Yi something we can check there?

@LASER-Yi
Copy link
Collaborator

LASER-Yi commented May 2, 2022

@LASER-Yi something we can check there?

Cannot reproduce. But I think there's something wrong with the backend. Those assets are served by this method and the MIME type is handling on the backend side.

@jotavip
Copy link

jotavip commented May 3, 2022

Same issue here on qBazarr running on my QNAP. Always worked without a problem, but from two days ago, blank page when trying to load. It seems that works and grabs subtitles on the background, but when trying to enter the web UI, blank page.

Removed it and reinstalled yesterday, lost all my config but apparently fixed the issue. But today, blank page again.

@morpheus65535
Copy link
Owner

This issue will be fixed in upcoming v1.0.5-beta.1 by this commit: af95f70

The cause of this issue is bad mime type configuration on the operating system hosting Bazarr (namely Windows). You can fix this by making sure that HKEY_CLASSES_ROOT/.js have a proper Content Type of application/javascript.

@morpheus65535 morpheus65535 changed the title Loading of Bazarr page failed Loading of Bazarr page failed (blank page) May 3, 2022
@morpheus65535 morpheus65535 pinned this issue May 3, 2022
@mannyotr
Copy link

mannyotr commented May 3, 2022

I am experiencing this same issue, but on macOS.

This is what I see on Terminal...

/Applications/bazarr>python3.8 -m pip install -r requirements.txt

Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (49.2.1)

Requirement already satisfied: lxml>=4.3.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 2)) (4.8.0)

Requirement already satisfied: numpy>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 3)) (1.22.3)

Requirement already satisfied: webrtcvad-wheels>=2.0.10 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (2.0.10.post2)

/Applications/bazarr>python3.8 bazarr.py

Bazarr starting...

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.

warnings.warn(

2022-05-02 10:25:12,090 - root (10d13ddc0) : INFO (server:37) - BAZARR is started and waiting for request on http://0.0.0.0:6767/

But when I navigate to http://localhost:6767/ the page is just blank.

When I view the source HTML for the blank page, this is what I get...

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bazarr</title>
<base href="/" />
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="./static/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"
/>
<meta
name="description"
content="Bazarr is a companion application to Sonarr and Radarr. It manages and downloads subtitles based on your requirements. You define your preferences by TV show or movie and Bazarr takes care of everything for you."
/>
<script type="module" crossorigin src="./assets/index.c6b646f7.js"></script>
<link rel="modulepreload" href="./assets/vendors.10e6a3a1.js">
<link rel="modulepreload" href="./assets/react-bootstrap.44c590f9.js">
<link rel="stylesheet" href="./assets/index.5997de93.css">
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
window.Bazarr = {"apiKey": "b9aee4f45dfb0747e8e834b9c66a977d", "baseUrl": "", "canUpdate": true, "hasUpdate": false};
</script>

</body>
</html>

@morpheus65535
Copy link
Owner

@mannyotr you can either find how to fix your mime types on macOS or switch to 1.0.5-beta.1 that should fix this.

@ninjonxb
Copy link

ninjonxb commented May 3, 2022

I believe the issue might still exist in Ubuntu on 1.0.5-beta.1

I am getting a white page and I have the following error in my console:

GEThttp://localhost:6767/assets/index.c6b646f7.js
[HTTP/1.1 500 INTERNAL SERVER ERROR 9ms]

GEThttp://localhost:6767/assets/index.5997de93.css
[HTTP/1.1 500 INTERNAL SERVER ERROR 5ms]

Loading failed for the module with source “http://localhost:6767/assets/index.c6b646f7.js”. localhost:6767:16:1
Loading module from “http://localhost:6767/assets/index.c6b646f7.js” was blocked because of a disallowed MIME type (“text/html”).
localhost:6767

However I do have this error in my terminal:

2022-05-03 19:51:07,403 - app.app                          (7f0c2dd27700) :  ERROR (app:1457) - Exception on /assets/index.c6b646f7.js [GET]
2022-05-03 19:51:07,408 - app.app                          (7f0c2d526700) :  ERROR (app:1457) - Exception on /assets/index.5997de93.css [GET]

This is on a new installation.

@morpheus65535
Copy link
Owner

@jonheckman can you share your bazarr.log file please?

@ninjonxb
Copy link

ninjonxb commented May 4, 2022

Sure:

03/05/2022 20:59:52|INFO    |root                            |BAZARR is started and waiting for request on http://***.***.***.***:6767|
03/05/2022 21:00:03|ERROR   |app.app                         |Exception on /assets/index.c6b646f7.js [GET]|'Traceback (most recent call last):\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1516, in full_dispatch_request\n    rv = self.dispatch_request()\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1502, in dispatch_request\n    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)\n  File "bazarr/main.py", line 124, in web_assets\n    return send_from_directory(path, filename)\n  File "/opt/bazarr/bazarr/../libs/flask/helpers.py", line 700, in send_from_directory\n    return werkzeug.utils.send_from_directory(  # type: ignore\n  File "/opt/bazarr/bazarr/../libs/werkzeug/utils.py", line 847, in send_from_directory\n    raise NotFound()\nwerkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 2073, in wsgi_app\n    response = self.full_dispatch_request()\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1518, in full_dispatch_request\n    rv = self.handle_user_exception(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  [Previous line repeated 7 more times]\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1386, in handle_user_exception\n    return self.handle_http_exception(e)\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1326, in handle_http_exception\n    return self.ensure_sync(handler)(e)\nTypeError: page_not_found() takes 0 positional arguments but 1 was given'|
03/05/2022 21:00:03|ERROR   |app.app                         |Exception on /assets/index.5997de93.css [GET]|'Traceback (most recent call last):\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1516, in full_dispatch_request\n    rv = self.dispatch_request()\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1502, in dispatch_request\n    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)\n  File "bazarr/main.py", line 124, in web_assets\n    return send_from_directory(path, filename)\n  File "/opt/bazarr/bazarr/../libs/flask/helpers.py", line 700, in send_from_directory\n    return werkzeug.utils.send_from_directory(  # type: ignore\n  File "/opt/bazarr/bazarr/../libs/werkzeug/utils.py", line 847, in send_from_directory\n    raise NotFound()\nwerkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 2073, in wsgi_app\n    response = self.full_dispatch_request()\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1518, in full_dispatch_request\n    rv = self.handle_user_exception(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  File "/opt/bazarr/bazarr/../libs/flask_restful/__init__.py", line 271, in error_router\n    return original_handler(e)\n  [Previous line repeated 7 more times]\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1386, in handle_user_exception\n    return self.handle_http_exception(e)\n  File "/opt/bazarr/bazarr/../libs/flask/app.py", line 1326, in handle_http_exception\n    return self.ensure_sync(handler)(e)\nTypeError: page_not_found() takes 0 positional arguments but 1 was given'|

@mannyotr
Copy link

mannyotr commented May 4, 2022

@mannyotr you can either find how to fix your mime types on macOS or switch to 1.0.5-beta.1 that should fix this.

@morpheus65535 , I tried 1.0.5-beta.1 but I still get a blank page.

>>cd /Applications/bazarr                     
/Applications/bazarr>
/Applications/bazarr>python3.8 bazarr.py                         
Bazarr starting...
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
2022-05-04 08:34:14,281 - root                             (105578dc0) :  INFO (server:39) - BAZARR is started and waiting for request on http://0.0.0.0:6767
2022-05-04 08:34:25,836 - app.app                          (70000b3c8000) :  ERROR (app:1457) - Exception on /assets/index.c6b646f7.js [GET]
2022-05-04 08:34:25,855 - app.app                          (70000c3cb000) :  ERROR (app:1457) - Exception on /assets/vendors.10e6a3a1.js [GET]
2022-05-04 08:34:25,884 - app.app                          (70000d3ce000) :  ERROR (app:1457) - Exception on /assets/react-bootstrap.44c590f9.js [GET]
2022-05-04 08:34:25,887 - app.app                          (70000e3d1000) :  ERROR (app:1457) - Exception on /assets/index.5997de93.css [GET]
2022-05-04 08:34:41,323 - app.app                          (7000123dd000) :  ERROR (app:1457) - Exception on /assets/react-bootstrap.44c590f9.js [GET]
2022-05-04 08:34:41,334 - app.app                          (7000133e0000) :  ERROR (app:1457) - Exception on /assets/vendors.10e6a3a1.js [GET]
2022-05-04 08:34:41,354 - app.app                          (7000143e3000) :  ERROR (app:1457) - Exception on /assets/index.5997de93.css [GET]
2022-05-04 08:34:41,358 - app.app                          (7000113da000) :  ERROR (app:1457) - Exception on /assets/index.c6b646f7.js [GET]
^Z
zsh: suspended  python3.8 bazarr.py
/Applications/bazarr>

Those ERROR messages only appear after I refresh the blank page at http://localhost:6767/.

Log file is attached.

bazarr.log

@morpheus65535
Copy link
Owner

Should be fixed definitely in upcoming 1.0.5-beta.3.

@m5050
Copy link

m5050 commented Jun 1, 2022

I was facing the same issue and I tried to have a look at it and try to fix it.
I edited the file in my windows system "C:\Bazarr\bazarr\main.py" to make Flask return "text/javascript" MIME on "js" files.

Old code:

bazarr/bazarr/main.py

Lines 117 to 119 in 135bdf2

def web_assets(filename):
path = os.path.join(os.path.dirname(__file__), '..', 'frontend', 'build', 'assets')
return send_from_directory(path, filename)

After changes:

def web_assets(filename):
    path = os.path.join(os.path.dirname(__file__), '..', 'frontend', 'build', 'assets')
    
    if filename.endswith("js"):
        return send_from_directory(path, filename, mimetype='text/javascript')

    else:
        return send_from_directory(path, filename)

However I don't know if this solution will cause another issues, but it works for me at least.

@morpheus65535
Copy link
Owner

@m5050 check dev branch, there's already a proper fix there.

@DaxDupont
Copy link

I'm still having issues @morpheus65535 and I'm on 1.1.0

@morpheus65535
Copy link
Owner

I'm still having issues @morpheus65535 and I'm on 1.1.0

Try to clear your browser cache, use incognito mode or use another browser.

@DaxDupont
Copy link

DaxDupont commented Jul 2, 2022 via email

@morpheus65535
Copy link
Owner

morpheus65535 commented Jul 2, 2022

I tried that, no go. Doesn't work in ff or chrome or incognito mode

I can't reproduce on 1.1.0 on Windows 10 even if I explicitely corrupt my mime types assignment for js file.

@Pridity
Copy link

Pridity commented Jul 3, 2022

Got the same issue with v1.1.0 on Windows 11. Tried it on 3 different browsers. Changing the MIME type in HKEY_CLASSES_ROOT/.js fixes it though.

@morpheus65535 morpheus65535 reopened this Jul 3, 2022
@morpheus65535
Copy link
Owner

morpheus65535 commented Jul 3, 2022

@vitiko98 can you reimplement the mimetypes definition removed in 1.0.5-beta.30?

That part but make it global instead: 4b71b8a#diff-0925fa8544c0514f5dbd00bcd7419cd9f84adb20d3dd3403529dc7a103d91a9fL80-L86

@vitiko98
Copy link
Collaborator

vitiko98 commented Jul 4, 2022

@morpheus65535 be93a92

@morpheus65535
Copy link
Owner

@DaxDupont can you test the upcoming 1.1.1-beta and confirm if it's fixed?

@Pridity
Copy link

Pridity commented Jul 6, 2022

I changed the MIME type in the registry again to something random to try the fix and can confirm that it's fixed in v1.1.1-beta.1

@morpheus65535
Copy link
Owner

I changed the MIME type in the registry again to something random to try the fix and can confirm that it's fixed in v1.1.1-beta.1

Good news! Thanks for reporting!

@jotavip
Copy link

jotavip commented Jul 6, 2022

I am still having this problem, even on 1.1.1 beta 1. Updated to this version on my qnap, it opened correctly, and after some hours blank page again. Tried different browsers and different devices, problem occurrs on all of them.

@Pridity
Copy link

Pridity commented Jul 7, 2022

I am still having this problem, even on 1.1.1 beta 1. Updated to this version on my qnap, it opened correctly, and after some hours blank page again. Tried different browsers and different devices, problem occurrs on all of them.

I ran into the same thing just now; it worked for a few hours and then a blank page. Turns out that automatic updates is on by default so it basically downgraded my version from v1.1.1-beta.1 to v1.1.0 which might be what happened to you as well. I'd suggest trying out the beta version again and then disabling updates for the time being until master branch gets updated.

@jotavip
Copy link

jotavip commented Jul 7, 2022

I am still having this problem, even on 1.1.1 beta 1. Updated to this version on my qnap, it opened correctly, and after some hours blank page again. Tried different browsers and different devices, problem occurrs on all of them.

I ran into the same thing just now; it worked for a few hours and then a blank page. Turns out that automatic updates is on by default so it basically downgraded my version from v1.1.1-beta.1 to v1.1.0 which might be what happened to you as well. I'd suggest trying out the beta version again and then disabling updates for the time being until master branch gets updated.

Installed The v1. 1.1-beta.2, and disabled The automatic update. Let's see if it works correct now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests