giaever-online-iot / zwave-js-ui

Fully configurable Z-wave JS Control Panel and Z-Wave to MQTT Gateway
MIT License
11 stars 1 forks source link

Snap v8.24.2: `Error: Not Found` in app.js on page view, blank site #4

Closed LordMike closed 1 year ago

LordMike commented 1 year ago

Hey.

I've had some dropouts with zwave-js where I can't turn lights on/off through HA, and now it happened again so I went to investigate. (Previously I just restarted zwavejs).

The website is blank - resources like js/css is 404'd. The console logs the following. I am unsure why resources would become lost. At least now, after a restart, they're still 404.

Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:21.940 INFO APP: GET /control-panel/registerSW.js 404 18.962 ms - 1308
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:21 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:22.890 INFO APP: GET /control-panel/ 304 2.015 ms - -
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:22.921 INFO APP: GET /control-panel/assets/index-06cc9b56.js 404 4.536 ms - 1308
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:22.933 INFO APP: GET /control-panel/assets/index-35a64e76.css 404 8.967 ms - 1308
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:22.938 INFO APP: GET /control-panel/registerSW.js 404 11.987 ms - 1308
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: Error: Not Found
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/server/app.js:1128:17
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Function.process_params (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:346:12)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at next (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:280:10)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at session (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express-session/index.js:479:7)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at Layer.handle [as handle_request] (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/layer.js:95:5)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at trim_prefix (/snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:328:13)
Sep 26 22:50:22 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]:     at /snap/zwave-js-ui/243/lib/zwave-js-ui/node_modules/express/lib/router/index.js:286:9
Sep 26 22:50:58 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:58.297 INFO Z-WAVE: [Node 022] Metadata updated: 50-0-value-65537
Sep 26 22:50:58 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:58.301 INFO Z-WAVE: [Node 022] Value updated: 50-0-value-65537 55.247 => 55.247
Sep 26 22:50:59 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:59.295 INFO Z-WAVE: [Node 022] Metadata updated: 50-0-value-66049
Sep 26 22:50:59 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:50:59.298 INFO Z-WAVE: [Node 022] Value updated: 50-0-value-66049 2.087 => 2.095
Sep 26 22:51:00 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:51:00.298 INFO Z-WAVE: [Node 022] Metadata updated: 50-0-value-66561
Sep 26 22:51:00 mbwodr02 zwave-js-ui.zwave-js-ui[1246094]: 2023-09-26 22:51:00.302 INFO Z-WAVE: [Node 022] Value updated: 50-0-value-66561 226.382 => 223.911

I've switched to candidate (v8.25.0) - no change I've switched to edge (v8.26.0) - no change

jmgiaever commented 1 year ago

Hi, thanks for reporting. I had something similar with earlier releases, but I guess I have to investigate further.

Do I understand it correctly that when this happens ZUI interface doesn't work either?

LordMike commented 1 year ago

I set out to investigate why my messages weren't getting through, and then found this - I think they're not related, as after a restart messages are passed through just fine.

But yea, the ZUI is completely gone. I get the root HTML document, but all three resources (2x js and 1x css) are 404.

LordMike commented 1 year ago

If I search /snap/zwave-js-ui/ for the resources that are missing, I do find them.

# find -iname registersw*
./249/lib/zwave-js-ui/dist/registerSW.js
./243/lib/zwave-js-ui/dist/registerSW.js

# find -iname index-*.js
./249/lib/zwave-js-ui/dist/assets/index-07fef15a.js
./249/lib/zwave-js-ui/dist/assets/index-c4ea8cfe.js
..
./243/lib/zwave-js-ui/dist/assets/index-06cc9b56.js
./243/lib/zwave-js-ui/dist/assets/index-e8d8cf0e.js
..

The files also have content and are world-readable.

LordMike commented 1 year ago

I attached with strace, and it doesn't seem like node is making any attempt at reading the js/css files (or maybe it did, and cached the negative response).

jmgiaever commented 1 year ago

Screenshot_20230928-142600.png

Hi. Do you happen to get a screen like this, or is it totally blank?

LordMike commented 1 year ago

Totally blank, see network view below.

image

image

LordMike commented 1 year ago

As I saw my own screenshot, I had the thought that maybe the hostname was an issue.

Well.. that's stupid.. I'll make an issue with zwave-js-ui.

image

jmgiaever commented 1 year ago

Ok. :) Can you link to the issue here, so I can keep track.

Also have you checked if the version in the candidate channel has the same issues? I know we fixed some errors in a release after the swap to Vitejs

LordMike commented 1 year ago

Omg. It's way worse. I was about to report it and needed reproduction steps, and I discovered that my browser has been navigating to http://zwave.home/control-panel. If I open the root page, I get redirected to http://zwave.home/#/control-panel

If I open the first link, it consistently fails and the latter consistently works.

Zwave-js-ui must have change the url somewhat recently, but not realized they've sent a 301 (permanent redirect) that my clients have remembered -- OR my browsers just have history for the ..e.home/control-panel link and I didn't realize.

jmgiaever commented 1 year ago

Yes, it's correct that ZUI now uses a hash based history. @robertsLando can probably explain this in more detail.

I don't know if it's possible to redirect /control-panel to #/control-panel, as many have struggled with the same because of the already stored history in their browsers, including me.

Clearing the history and updating bookmarks should remove the old entries, but that's not so obvious.

LordMike commented 1 year ago

Thats not at all obvious. No.

I would highly recommend a redirect (and it is possible), but I’m not going to champion it :).

Thanks for your help btw.

Mike.

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Joachim Marthinsen Giæver @.> Sent: Thursday, September 28, 2023 5:34:14 PM To: giaever-online-iot/zwave-js-ui @.> Cc: Michael Bisbjerg @.>; State change @.> Subject: Re: [giaever-online-iot/zwave-js-ui] Snap v8.24.2: Error: Not Found in app.js on page view, blank site (Issue #4)

Yes, it's correct that ZUI now uses a hash based history. @robertsLandohttps://github.com/robertsLando can probably explain this in more detail.

I don't know if it's possible to redirect /control-panel to #/control-panel, as many have struggled with the same because of the already stored history in their browsers, including me.

Clearing the history and updating bookmarks should remove the old entries, but that's not so obvious.

— Reply to this email directly, view it on GitHubhttps://github.com/giaever-online-iot/zwave-js-ui/issues/4#issuecomment-1739549659, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAH2YJ57U5CC74FSWBQWQBLX4WKHNANCNFSM6AAAAAA5IKYB2U. You are receiving this because you modified the open/close state.Message ID: @.***>

robertsLando commented 1 year ago

I tried to do an automatic redirect from backend but unfortunately it's not that easy as I expected as this could have some unexpected behaviors with resources, I need to do some more tests BTW there is already an open issue related to this

robertsLando commented 1 year ago

FYI: https://github.com/zwave-js/zwave-js-ui/pull/3308

LordMike commented 1 year ago

Thanks! :)

Mike.

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Daniel Lando @.> Sent: Friday, September 29, 2023 11:15:20 AM To: giaever-online-iot/zwave-js-ui @.> Cc: Michael Bisbjerg @.>; State change @.> Subject: Re: [giaever-online-iot/zwave-js-ui] Snap v8.24.2: Error: Not Found in app.js on page view, blank site (Issue #4)

FYI: zwave-js/zwave-js-ui#3308https://github.com/zwave-js/zwave-js-ui/pull/3308

— Reply to this email directly, view it on GitHubhttps://github.com/giaever-online-iot/zwave-js-ui/issues/4#issuecomment-1740569561, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAH2YJ2UKEJWCWVK2BET3NTX42GSRANCNFSM6AAAAAA5IKYB2U. You are receiving this because you modified the open/close state.Message ID: @.***>