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

JS files are blocked when reloading the page #22501

Closed
SanderVanDenBerk opened this issue Sep 21, 2023 · 4 comments
Closed

JS files are blocked when reloading the page #22501

SanderVanDenBerk opened this issue Sep 21, 2023 · 4 comments
Labels

Comments

@SanderVanDenBerk
Copy link

Issue

I have a selfhosted ERPNext server which is upgraded from v12 to v13. I have finished the upgrade and all of the data and apps are working. The only problem is that my public JS files are blocked when I reload the page. Everything works when I login for the first time or clean my cache/cookies, but when I refresh the page then my JS files are blocked. This is because the MIME type is mismatch (see screenshot).

image

I have upgrade ERPNext and Frappe to version 13
image

Steps to reproduce the issue

  1. Upgrade v12 server to v13.
  2. Login and refresh the page.

Any idea where I can look to fix this?

@cogk
Copy link
Contributor

cogk commented Sep 22, 2023

I believe this kind of error means that the server does serve a 404 page (which has a text/html content type) instead of sending a JavaScript file.

Does this file come from a custom app? Maybe try to check in the frappe-bench/sites/assets/ directory to find the files. If they do not exist then you've found the problem.

Maybe this problem is related to the new build system based on eslint, which might have happened between v12 and v13 (I don't remember sorry).

@SanderVanDenBerk
Copy link
Author

@cogk Thanks for the help. The server return a HTML page instead of the JS file, but it is not because it cannot find the JS file. It is because the URL is incorrect. I looks the asset page of ERPNext and not the JS file. I think this is because the URL is incorrect. The URL is: //192.168.1.41/app/assets/production_batch/js/jsgantt.js, but this should be //192.168.1.41/assets/production_batch/js/jsgantt.js

I have created a GIF with the problem and how I can get the JS file the the browser. Any idea how I can fix the URL?

Code_OWFxOqjQlx

@cogk
Copy link
Contributor

cogk commented Sep 22, 2023

Okay, and how is jsgantt.js loaded in the code? Is it in a hook (like app_include_js)?

@SanderVanDenBerk
Copy link
Author

@cogk YESSSSS, it is fixed. The problem was the app_include_js. I needed to add a / in front of the path. THANK YOU.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants