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

fix: ensure settings contains default and do not throw errors #2328

Merged
merged 8 commits into from
Mar 22, 2022

Conversation

robertsLando
Copy link
Member

Fixes #2325

@robertsLando
Copy link
Member Author

@kpine @LordMike could you give this a try?

@zwave-js-assistant
Copy link

🚧 It seems like this PR has lint errors 🚧

I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint

1 similar comment
@zwave-js-assistant
Copy link

🚧 It seems like this PR has lint errors 🚧

I should be able to fix them for you. If you want me to, just comment
@zwave-js-bot fix lint

@LordMike
Copy link
Contributor

I built the docker image, and ran it just once:

> docker run -it --rm test
/bin/sh: git: not found
2022-03-21 08:48:55.420 INFO APP: Version: 6.5.2
2022-03-21 08:48:55.421 INFO APP: Application path:/usr/src/app

 ______                       _     ___                  _   _
|___  /                      (_)   |__ \                | | | |
   / /_      ____ ___   _____ _ ___   ) |_ __ ___   __ _| |_| |_
  / /\ \ /\ / / _` \ \ / / _ \ / __| / /| '_ ` _ \ / _` | __| __|
 / /__\ V  V / (_| |\ V /  __/ \__ \/ /_| | | | | | (_| | |_| |_
/_____|\_/\_/ \__,_| \_/ \___| |___/____|_| |_| |_|\__, |\__|\__|
                            _/ |                      | |
                           |__/                       |_|

2022-03-21 08:48:55.429 WARN STORE: settings.json not found
2022-03-21 08:48:55.434 WARN STORE: scenes.json not found
2022-03-21 08:48:55.435 WARN STORE: nodes.json not found
2022-03-21 08:48:55.440 WARN STORE: users.json not found
2022-03-21 08:48:55.445 INFO APP: Listening on port 8091 host 0.0.0.0 protocol HTTP
TypeError: Cannot read property 'disabled' of undefined
    at Gateway.start (/usr/src/app/server/lib/Gateway.js:180:29)
    at startGateway (/usr/src/app/server/app.js:235:14)
    at startServer (/usr/src/app/server/app.js:175:11)

@coveralls
Copy link

coveralls commented Mar 21, 2022

Pull Request Test Coverage Report for Build 2020978190

  • 8 of 69 (11.59%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 27.067%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app.ts 0 1 0.0%
lib/Gateway.ts 2 13 15.38%
config/store.ts 0 24 0.0%
lib/ZwaveClient.ts 0 25 0.0%
Totals Coverage Status
Change from base Build 2016276934: 0.006%
Covered Lines: 3642
Relevant Lines: 14187

💛 - Coveralls

@robertsLando
Copy link
Member Author

@LordMike try now

@LordMike
Copy link
Contributor

> docker run -it --rm test
/bin/sh: git: not found
2022-03-21 11:21:16.335 INFO APP: Version: 6.5.2
2022-03-21 11:21:16.337 INFO APP: Application path:/usr/src/app

 ______                       _     ___                  _   _
|___  /                      (_)   |__ \                | | | |
   / /_      ____ ___   _____ _ ___   ) |_ __ ___   __ _| |_| |_
  / /\ \ /\ / / _` \ \ / / _ \ / __| / /| '_ ` _ \ / _` | __| __|
 / /__\ V  V / (_| |\ V /  __/ \__ \/ /_| | | | | | (_| | |_| |_
/_____|\_/\_/ \__,_| \_/ \___| |___/____|_| |_| |_|\__, |\__|\__|
                            _/ |                      | |
                           |__/                       |_|

2022-03-21 11:21:16.347 WARN STORE: settings.json not found
2022-03-21 11:21:16.352 WARN STORE: scenes.json not found
2022-03-21 11:21:16.352 WARN STORE: nodes.json not found
2022-03-21 11:21:16.358 WARN STORE: users.json not found
2022-03-21 11:21:16.365 INFO APP: Listening on port 8091 host 0.0.0.0 protocol HTTP
TypeError: Cannot read property 'on' of undefined
    at Gateway.start (/usr/src/app/server/lib/Gateway.js:174:24)
    at startGateway (/usr/src/app/server/app.js:235:14)
    at startServer (/usr/src/app/server/app.js:175:11)

@robertsLando
Copy link
Member Author

Yeah stupid error, now I tried to run mine and it seems to work. LMK :)

@LordMike
Copy link
Contributor

I can now run this PR with a volume, open the site, click ok to the tracking thing, close it down and start it up again without the dialog. So settings works, and all the other config files exist (no warnings) and can load.

There was one error, which I can't reproduce:

2022-03-21 18:10:03.542 WARN STORE: settings.json not found
2022-03-21 18:10:03.547 WARN STORE: scenes.json not found
2022-03-21 18:10:03.563 INFO APP: Listening on port 8091 host 0.0.0.0 protocol HTTP
2022-03-21 18:10:03.582 WARN ZWAVE: Zwave driver not inited, no port configured
2022-03-21 18:10:07.032 INFO APP: GET / 200 9.743 ms - 1410
2022-03-21 18:10:07.125 INFO APP: GET /static/css/app.dfe48ed45f099bfc6154.css 200 5.229 ms - 644099
2022-03-21 18:10:07.136 INFO APP: GET /static/js/app.4530e1ff22bb0b44a365.js 200 4.160 ms - 2076062
2022-03-21 18:10:07.463 INFO APP: GET /api/auth-enabled 200 4.397 ms - 29
2022-03-21 18:10:07.722 INFO APP: GET /api/settings 200 89.283 ms - 12381
2022-03-21 18:10:07.724 INFO APP: GET /static/fonts/MaterialIcons-Regular.fa3334f.woff2 200 32.906 ms - 82492
2022-03-21 18:10:07.725 INFO APP: GET /static/logo.png 200 31.179 ms - 10014
2022-03-21 18:10:07.797 INFO APP: GET /static/favicons/favicon-32x32.png 200 1.477 ms - 1831
2022-03-21 18:10:07.801 INFO APP: GET /api/auth-enabled 304 2.011 ms - -
2022-03-21 18:10:07.803 INFO APP: GET /static/favicons/site.webmanifest 200 4.616 ms - 429
2022-03-21 18:10:09.035 ERROR APP: undefined
2022-03-21 18:10:09.036 INFO APP: POST /api/statistics 200 9.827 ms - 82
^C2022-03-21 18:10:17.421 WARN APP: Shutdown detected: closing clients...
2022-03-21 18:10:17.424 INFO GATEWAY: Closing Gateway...
2022-03-21 18:10:17.427 INFO ZWAVE: Client closed

I canceled the app (Cltr+c) shortly after this error..., so maybe it was shutting down when the error occurred..

In any case. I can't reproduce it right now (removing volume etc does nothing), so maybe it's just a fluke.

@robertsLando
Copy link
Member Author

@LordMike Thanks for your report! I tried on my side and I cannot reproduce your error but I will keep it monitored.

@robertsLando
Copy link
Member Author

@LordMike I may have fund what could go wrong here, it could happen that when you enable stats and driver is not ready it throws, now it silently fail with a warn log

@robertsLando robertsLando merged commit 010f22e into master Mar 22, 2022
@robertsLando robertsLando deleted the fix#2325 branch March 22, 2022 08:03
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

Successfully merging this pull request may close these issues.

[Bug]: Nodes.json can be empty, when no configuration is set
3 participants