[Issue]: Browser does not load any JS files from server #2789
Closed
2 tasks done
Idcrafter opened this issue on Feb 2 · 24 comments
Comments
@Idcrafter
Idcrafter commented on Feb 2
Issue Description
i can't generate images with the Webui but i can generate images via the API and i looked into the Debug Console which is spiting out this error after pressing the Generate Button:
Uncaught (in promise) ReferenceError: submit_txt2img is not defined
anonymous Blocks-f539b5d2.js line 44 > AsyncFunction:3
ke Blocks-f539b5d2.js:45
en Blocks-f539b5d2.js:45
en Blocks-f539b5d2.js:45
dispatch Blocks-f539b5d2.js:12
w StaticButton.svelte:39
xc lifecycle.js:181
xc lifecycle.js:181
Button.svelte:16
and more errors:
async function anonymous(__fn_args
) {
_________( "await" is marked as ReferenceError: submit_txt2img is not defined)
let result = await ((val) => markIfModified("image_metadata", val))(...__fn_args);
return (false && !Array.isArray(result)) ? [result] : result;
}
I have read the above and searched for existing issues
I confirm that this is classified correctly and its not an extension issue
@vladmandic
Owner
vladmandic commented on Feb 3
only way i could think that could happen is if main js code never initialized which means there should be errors much earlier than this one.
post entire browser console log leading to this.
@vladmandic vladmandic added the question label on Feb 3
@Idcrafter
Author
Idcrafter commented on Feb 3
this is all the Console shows when running ./webui.sh
Create and activate python venv
Launching launch.py...
03:50:01-803731 INFO Starting SD.Next
03:50:01-805466 INFO Logger: file="/home/idcrafter/automatic/sdnext.log"
level=INFO size=20850 mode=append
03:50:01-806057 INFO Python 3.10.13 on Linux
03:50:01-820823 INFO Version: app=sd.next updated=2024-01-30 hash=9bf08c54
url=https://github.com/vladmandic/automatic/tree/master
03:50:02-112813 INFO Platform: arch=x86_64 cpu= system=Linux
release=6.6.14-200.fc39.x86_64 python=3.10.13
03:50:02-114396 INFO nVidia CUDA toolkit detected: nvidia-smi present
03:50:02-129284 INFO Extensions: disabled=[]
03:50:02-129876 INFO Extensions: enabled=['Lora', 'sd-extension-chainner',
'sd-extension-system-info', 'sd-webui-agent-scheduler',
'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
'stable-diffusion-webui-rembg'] extensions-builtin
03:50:02-131140 INFO Extensions: enabled=[] extensions
03:50:02-131632 INFO Startup: quick launch
03:50:02-131997 INFO Verifying requirements
03:50:02-134050 INFO Verifying packages
03:50:02-134681 INFO Extensions: disabled=[]
03:50:02-135124 INFO Extensions: enabled=['Lora', 'sd-extension-chainner',
'sd-extension-system-info', 'sd-webui-agent-scheduler',
'sd-webui-controlnet', 'stable-diffusion-webui-images-browser',
'stable-diffusion-webui-rembg'] extensions-builtin
03:50:02-135954 INFO Extensions: enabled=[] extensions
03:50:02-137500 INFO Extension preload: {'extensions-builtin': 0.0, 'extensions': 0.0}
03:50:02-138267 INFO Command line args: []
03:50:04-692370 INFO Load packages: torch=2.2.0+cu121 diffusers=0.25.0 gradio=3.43.2
03:50:05-169594 INFO Engine: backend=Backend.DIFFUSERS compute=cuda mode=no_grad
device=cuda cross-optimization="Scaled-Dot-Product"
03:50:05-194410 INFO Device: device=NVIDIA GeForce RTX 4090 n=1 arch=sm_90 cap=(8, 9)
cuda=12.1 cudnn=8902 driver=545.29.06
03:50:07-040436 INFO Available VAEs: path="models/VAE" items=0
03:50:07-041226 INFO Disabled extensions: ['sd-webui-controlnet']
03:50:07-042388 INFO Available models: path="models/Stable-diffusion" items=12 time=0.00
03:50:07-200362 INFO Extension: script='scripts/faceid.py' [2;36m03:50:07-199442[0m[2;36m
[0m[1;31mERROR [0m FaceID: No module named [32m'insightface'[0m
03:50:07-686590 INFO Extension:
script='extensions-builtin/sd-webui-agent-scheduler/scripts/task_sch
eduler.py' Using sqlite file:
extensions-builtin/sd-webui-agent-scheduler/task_scheduler.sqlite3
03:50:08-033307 INFO Extensions time: 0.86 { Lora=0.28 sd-webui-agent-scheduler=0.17 stable-diffusion-webui-images-browser=0.35 }
03:50:08-057510 INFO Load UI theme: name="gradio/soft" style=Dark base=base.css
03:50:08-058195 WARNING Using Gradio default theme which is not optimized for SD.Next
03:50:09-142451 INFO Local URL:
03:50:09-143231 INFO Initializing middleware
03:50:09-230368 INFO [AgentScheduler] Task queue is empty
03:50:09-231069 INFO [AgentScheduler] Registering APIs
03:50:09-300262 INFO Startup time: 7.15 { torch=2.01 gradio=0.52 libraries=2.35 extensions=0.86 face-restore=0.13 ui-extra-networks=0.05 ui-settings=0.10
ui-extensions=0.19 ui-defaults=0.31 launch=0.31 app-started=0.11 }
@vladmandic
Owner
vladmandic commented on Feb 3
Browser console.
@Idcrafter
Author
Idcrafter commented on Feb 3
ok if i just open the webui then does the browser show me this:
InstallTrigger is deprecated and will be removed in the future. constants.js:50:15
Loading failed for the with source “. 127.0.0.1:7860:58:84
Loading failed for the with source “. 127.0.0.1:7860:59:95
Loading failed for the with source “. 127.0.0.1:7860:60:89
Loading failed for the with source “. 127.0.0.1:7860:61:84
Loading failed for the with source “. 127.0.0.1:7860:62:85
Loading failed for the with source “. 127.0.0.1:7860:63:90
Loading failed for the with source “. 127.0.0.1:7860:64:87
Loading failed for the with source “. 127.0.0.1:7860:65:90
Loading failed for the with source “. 127.0.0.1:7860:66:93
Loading failed for the with source “. 127.0.0.1:7860:67:82
Loading failed for the with source “. 127.0.0.1:7860:68:89
Loading failed for the with source “. 127.0.0.1:7860:69:88
Loading failed for the with source “. 127.0.0.1:7860:70:88
Loading failed for the with source “. 127.0.0.1:7860:71:83
Loading failed for the with source “. 127.0.0.1:7860:72:87
Loading failed for the with source “. 127.0.0.1:7860:73:89
Loading failed for the with source “. 127.0.0.1:7860:74:81
Loading failed for the with source “. 127.0.0.1:7860:75:84
Loading failed for the with source “. 127.0.0.1:7860:76:88
Loading failed for the with source “. 127.0.0.1:7860:77:90
Loading failed for the with source “. 127.0.0.1:7860:78:85
Loading failed for the with source “. 127.0.0.1:7860:79:85
Loading failed for the with source “. 127.0.0.1:7860:80:89
Loading failed for the with source “. 127.0.0.1:7860:81:79
Loading failed for the with source “. 127.0.0.1:7860:82:85
Loading failed for the with source “. 127.0.0.1:7860:83:169
Loading failed for the with source “. 127.0.0.1:7860:84:172
Loading failed for the with source “. 127.0.0.1:7860:85:174
Loading failed for the with source “. 127.0.0.1:7860:86:184
Loading failed for the with source “. 127.0.0.1:7860:87:190
Request for font "Noto Serif" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Noto Naskh Arabic" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Times New Roman" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Uncaught ReferenceError: set_theme is not defined
127.0.0.1:7860:116:661
Request for font "Bitstream Vera Sans" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Noto Sans Arabic" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Noto Sans" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Liberation Sans Narrow" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Tahoma" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Open Sans" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Noto Sans Mono" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
Request for font "Luxi Mono" blocked at visibility level 2 (requires 3)
127.0.0.1:7860
InstallTrigger is deprecated and will be removed in the future.
@vladmandic
Owner
vladmandic commented on Feb 3
Your browser is pretty much blocking loading of entire JS code, it only loads base HTML.
What's the browser? Any proxies, VPNs, browser extensions?
Try with a different browser?
@Idcrafter
Author
Idcrafter commented on Feb 3
no VPN no Proxy it is Firefox with Ublock origin and rest is stock settings and i also can't generate with Google chrome does it give out this error:
Failed to load resource: the server responded with a status of 403 (Forbidden)
aspectRatioOverlay.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
contextMenus.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
control.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
dragDrop.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
editAttention.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
extensions.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
base.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
generationParams.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
extraNetworks.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
imageMaskFix.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
hires.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
imageParams.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
logMonitor.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
nvml.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
imageViewer.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
notification.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
loader.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
settings.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
progressBar.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
setHints.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
trainMonitor.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
panZoom.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
promptChecker.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
uiConfig.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
sparkline.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
agent-scheduler.iife.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
jquery.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
ui.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
system-info.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
image_browser.js:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
(index):116 Uncaught ReferenceError: set_theme is not defined
at (index):116:661
VM57:3 Uncaught (in promise) ReferenceError: submit_txt2img is not defined
at Object.eval [as frontend_fn] (eval at (Blocks.svelte:66:25), :3:14)
at ke (Blocks.svelte:413:6)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
base.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
style.css:1
Failed to load resource: the server responded with a status of 403 (Forbidden)
@vladmandic
Owner
vladmandic commented on Feb 4 •
Failed to load resource: the server responded with a status of 403 (Forbidden)
honestly, i have no idea why your browser is refusing to load any JS files.
what are the command line flags you use to start the server?
and check in browser inspector network tab details for one of those requests
for example, this is how it should look like:
image
InstallTrigger is deprecated and will be removed in the future. constants.js:50:15
that is not part of sdnext, so most likely its a bad browser extension. probably not related to current loading issues, just noting.
@vladmandic vladmandic added platform and removed question labels on Feb 4
@vladmandic vladmandic changed the title [Issue]: unable tp Generate anything in the webui [Issue]: Browser does not load any JS files from server on Feb 4
@Idcrafter
Author
Idcrafter commented on Feb 4
on Chromium with no addons and no tweaks does the network tab look like this for me:
grafik
@Idcrafter
Author
Idcrafter commented on Feb 4
and this is the info for the script.js that is the first that failed:
grafik
@vladmandic
Owner
vladmandic commented on Feb 4
its actual 403 :(
what type of a folder/link/mount/storage is /home/idcrafter/automatic and is javascript just a simple subfolder inside it?
@Idcrafter
Author
Idcrafter commented on Feb 4
it's a normal folder that got created when cloning this repo via git clone and javascript is a subfolder with 38 files inside which are 2,5 MiB large
all files have the same permissions which are (drwxr-xr-x.).
my system is Fedora 39
@vladmandic
Owner
vladmandic commented on Feb 4
just verify, check permissions for all folder levels leading to /home/idcrafter/automatic/javascript
i cannot reproduce the problem and i've tried quite a few different scenarios nor is the problem visible to pretty much any other user so far.
@Idcrafter
Author
Idcrafter commented on Feb 4
idcrafter is the home folder for the user idcrafter which is the one logged into the desktop i am using to run Stable Diffusion and the browser and all folders from automatic and files in automatic are (drwxr-xr-x.). also are the SELinux context for all the files from automatic is (unconfined_u:object_r:data_home_t:s0 automatic). all files are owned by the idcrafter user so should it work.
@vladmandic
Owner
vladmandic commented on Feb 4
it should - really no idea why.
@vladmandic vladmandic added the help wanted label on Feb 4
@Idcrafter
Author
Idcrafter commented on Feb 4
also did i notice that the UI seems a bit off for me compared to the screenshots here on the repo
grafik
@vladmandic
Owner
vladmandic commented on Feb 4
Because it never loaded JS code to apply the theme.
@lbeltrame
Contributor
lbeltrame commented on Feb 5 •
If you use setenforce to set SELinux to permissive, does that work?
EDIT:
You might want to check as well httpd_sys_content_t (ref: https://stackoverflow.com/questions/22586166/why-does-nginx-return-a-403-even-though-all-permissions-are-set-properly)
@Idcrafter
Author
Idcrafter commented on Feb 6
i can't disable SELinux because i need it for management of permissions. and with setting the httpd_sys_content_t for the whole automatic folder still produces the same error.
@lbeltrame
Contributor
lbeltrame commented on Feb 6
I meant it only as a temporary measure to see whether it works or not. If it's SELinux, then the problem is narrowed down to that. If the issue still persists instead, it's something else.
@Idcrafter
Author
Idcrafter commented on Feb 6
ok i tried it after disabling SELinux and rebooting and no it also still does the same.
@vladmandic
Owner
vladmandic commented on Feb 10
try one more thing if you can - switch to dev branch and add --allowed-paths javascript,html as cli param.
i've just added that feature to allow forcing web server permissions for specific paths. normally its not needed as sdnext root path is always allowed and javascript is just a subfolder, but its worth a try.
@Idcrafter
Author
Idcrafter commented on Feb 10
i did just pull the dev branch and added --allowed-paths javascript,html and got such errors even after temporarily disabling SELinux to test if this could be a problem:
ERROR API error: GET: http://127.0.0.1:7860/file=javascript/black-teal.css?1707576610.0 {'error': 'HTTPException', 'code':
403, 'detail': 'File not allowed: javascript/black-teal.css.', 'body': '', 'errors': '403: File not allowed:
javascript/black-teal.css.'}
@vladmandic
Owner
vladmandic commented on Feb 12
i didn't think it would, but needed to rule it out - this basically rules out any permissions checks within sdnext or gradio since it explicitly adds path to allowed list bypassing autodetect. which means its really os that is enforcing permission denied on your system.
It seems that the issue is arising because Gradio, the web framework used by SD.Next, is refusing to serve the JavaScript files due to its security policy regarding file serving. Gradio restricts serving files to specific allowed paths for security reasons.
When you start the SD.Next server, Gradio needs to know which directories are safe to serve static files from. By default, it only allows certain paths, and if the JavaScript files are outside these paths, you'll get a 403 Forbidden error.
Although you tried adding --allowed-paths javascript,html, it didn't resolve the issue. This is likely because Gradio requires absolute paths for the allowed_paths parameter.
Here's what you can try:
Use Absolute Paths in --allowed-paths:
Start the SD.Next server with the --allowed-paths parameter specifying the absolute paths to the javascript and html directories. For example:
This tells Gradio explicitly that it's allowed to serve files from these directories.
Check the SD.Next Code for allowed_paths Configuration:
Ensure that the SD.Next application's code is correctly passing the allowed_paths to the Gradio app. In some versions, the allowed_paths might not be set properly. You can look into the code where the Gradio app is initialized and verify that it's including your javascript directory.
Update SD.Next and Gradio:
Make sure you're using the latest versions of SD.Next and Gradio. Sometimes, these issues are resolved in newer releases.
Update SD.Next:
git pull
Update Gradio within your virtual environment:
pip install --upgrade gradio
Check for Symlinks or Path Issues:
Ensure that there are no symbolic links in the path to the javascript directory that might confuse the path resolution. Gradio might resolve the real path differently if symlinks are involved, leading to mismatches in allowed paths.
Verify File and Directory Permissions:
Double-check the permissions of all directories leading up to and including the javascript folder. The directories should be executable (+x) and readable (+r) by the user running SD.Next.
Try running SD.Next without any extensions or custom configurations to see if the issue persists. This can help determine if an extension is causing the problem.
Check SELinux Logs:
Since you're on Fedora, even though you've disabled SELinux, there might be residual policies or logs that can provide insight. Check /var/log/audit/audit.log for any denied entries related to your application.
Review Gradio's Security Policy:
Gradio has recently updated its security policy to be more restrictive about serving files. You can refer to the Gradio documentation regarding file serving and ensure that your setup complies with their guidelines.
Consider Using a Different Port or Host:
Sometimes, local firewall rules or other services might interfere with serving files on certain ports. Try changing the host or port when starting SD.Next:
./webui.sh --listen-host 0.0.0.0 --port 8000
Collect Detailed Logs:
Increase the verbosity of the SD.Next logging to get more detailed information about what's happening when it tries to serve the files. This might involve setting an environment variable or modifying the logging configuration.
By ensuring that the allowed_paths include the absolute paths to your static files, Gradio should allow these files to be served, and the 403 Forbidden errors should disappear.
If you've tried all these steps and the issue persists, it might be helpful to open a new issue on the SD.Next GitHub repository with detailed logs and configurations. The maintainers or other contributors might have additional insights or might identify a bug that needs to be fixed.