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

Blank screen in kweb #14

Closed
atd opened this issue Mar 16, 2020 · 15 comments
Closed

Blank screen in kweb #14

atd opened this issue Mar 16, 2020 · 15 comments

Comments

@atd
Copy link
Contributor

atd commented Mar 16, 2020

I just built ONE branch using yarn build (without MQTT_SERVER env variable) and deployed it to my HestiaPi instance. But it just shows a blank screen

I also access via ssh and forward the display to my desktop, run kweb -J /home/pi/oneui.bad/index.html but it just does the same

However, if I open the file with Chromium it does shows Off, info icon, etc.. with some errors in the javascript console regarding MQTT connection to localhost (as expected) and one additional error about a ServiceWorker

register-service-worker.js:29 Error during service worker registration: TypeError: Failed to register a ServiceWorker: The URL protocol of the current origin ('null') is not supported.
    at o (index.js:51)
    at index.js:43
error @ register-service-worker.js:29
stream.js:64 WebSocket connection to 'ws://localhost:9001/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
u @ stream.js:64
stream.js:64 WebSocket connection to 'ws://localhost:9001/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

Any clues on what might go wrong, or how I can debug it?

@gulliverrr
Copy link
Contributor

Can you load from your desktop this URL on a browser?
[HestiaPi_IP]:8080

@atd
Copy link
Contributor Author

atd commented Mar 16, 2020

Yes, openHAB loads as usual

Also, if I run MQTT_SERVER=HestiaPi_IP yarn serve and open the url in my desktop, it connects without any problem and shows temperature, humidity, heater icons, etc...

@gulliverrr
Copy link
Contributor

Can you subscribe for MQTT topics to see if they are published/updated when you play with OH ?

@atd
Copy link
Contributor Author

atd commented Mar 16, 2020

I don't think it is a MQTT problem, everything seems to be ok in the openHAB side

I run MQTT_Explorer and can see topics updating

Besides, I can run the original one-ui (I made a backup 😄) with kweb -J /home/pi/scripts/oneui/index.html and it works ok

@gulliverrr
Copy link
Contributor

I think it may be a permission thing with the UI files you built... Try running the chmod and chown commands related to the paths that include the /oneui from the update script.

@atd
Copy link
Contributor Author

atd commented Mar 16, 2020

Ok, so I managed to build a kind of trace mechanism in kweb using

<script>window.onerror = function(msg, url, lineNo, columnNo, error) { alert(msg); alert(url); alert(lineNo); alert(columnNo); alert(error); }</script>

just before the <noscript> tag (before js scripts load) and I get the following:

msg: SyntaxError: Unexpected identifier 'r'
url: file:///home/pi/oneui.bad/js/chunk-vendors.00f6062f.js
lineNo: 13
columnNo: 0
error: undefined

So it seems to be an issue regarding webpack and minification?

@jaythomas
Copy link
Collaborator

@atd which commit revision are you on? Also, can you update vue.config.js to not minify and see what the real line number/error is? #13 (comment)

@atd
Copy link
Contributor Author

atd commented Mar 17, 2020

I am at 359e7f2

I checked it without minification and I get

SyntaxError: Unexpected identifier 'index'
file:///home/pi/oneui.bad/js/chunk-vendors.ba4f48e6.js
13619
0
undefined

which corresponds to

let index = 0;

This is the first appearance of in that file, let so it seems to be a babel transpiler issue

@atd
Copy link
Contributor Author

atd commented Mar 17, 2020

I can confirm the let issue, because in my new generated dist/js/chunk-vendors.xxx.js I can find statements like let r= but I cannot find them in the original HestiaPi's

I have tried to configure vue browserlists to safari 9, because it uses webkit like kweb, and it is the latest Safari version not supporting let but I still see the let statements in the dist/ file 😞

@jaythomas
Copy link
Collaborator

Thanks for the additional information. That's a bit puzzling as nothing in the build process has changed over the last several commits and unfortunately I am not able to replicate the issue. The bundle I generate from running yarn build is strictly ES5.

I'll have to take a closer look at the babel and webpack config tomorrow if you're still having issues. Do you remember which commit were you building that you weren't seeing the issue?

@atd
Copy link
Contributor Author

atd commented Mar 18, 2020

Yes, I think it is something related to my setup. I have:

node version: 10.17.0
yarn version: 1.22.0

I started a git bisect, I tested until 6ee0e50 and all of them were failing as well

I haven't be able to get a build that is ES5

jaythomas added a commit that referenced this issue Mar 18, 2020
@jaythomas
Copy link
Collaborator

@atd I've added my yarn.lock file to the repo. Try deleting your lock file if you have one, pulling the latest change, and running yarn to update your node modules.

If you still have issues with your generated build try updating to the latest version of node. Here's the versions I'm using:

node version: 13.9.0
yarn version: 1.12.3

@gulliverrr
Copy link
Contributor

@jaythomas the .lock file caused these alerts.

@atd
Copy link
Contributor Author

atd commented Mar 18, 2020

Sure, I will ASAP

@gulliverrr I cannot access the alerts (404), but I was missing the yarn.lock. It is recommended to be checked into the source control

@atd
Copy link
Contributor Author

atd commented Mar 18, 2020

Yay! That did it! Now I can see the UI working fine

Thank you both for your support!

@atd atd closed this as completed Mar 18, 2020
jaythomas added a commit that referenced this issue Mar 19, 2020
jaythomas added a commit that referenced this issue Mar 19, 2020
jaythomas added a commit that referenced this issue Mar 19, 2020
helgew pushed a commit to helgew/hestia-touch-one-ui that referenced this issue Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants