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

Cannot perform OTA updates from zwave-js-ui from packaged application #3411

Closed
garbled1 opened this issue Nov 7, 2023 · 14 comments · Fixed by #3490
Closed

Cannot perform OTA updates from zwave-js-ui from packaged application #3411

garbled1 opened this issue Nov 7, 2023 · 14 comments · Fixed by #3490
Assignees
Labels
bug Something isn't working

Comments

@garbled1
Copy link

garbled1 commented Nov 7, 2023

Whenever I click on CHECK UPDATES or the OTA tab on a device, I get the following message:

Error while calling getAvailableFirmwareUpdates: Cannot check for firmware updates for node 11: Invalid host defined options (ZW0261)

I'm running 9.3.1 from zwave-js-ui-v9.3.1-linux.zip in the releases. Is there something I'm supposed to configure to get this feature working?

@garbled1 garbled1 added the question Further information is requested label Nov 7, 2023
@robertsLando
Copy link
Member

I sincerly never saw such error. I need to ask @AlCalzone what that means

@AlCalzone
Copy link
Member

@marcus-j-davies you had that in your dotnet wrapper, didn't you?

@marcus-j-davies
Copy link
Member

marcus-j-davies commented Nov 8, 2023

Yup!

Its the got library I believe.
Running the driver through esbuild resolves it for me, before using pkg

Its the pkg limitation with ES Modules, and got is indeed an ES Module.
but esbuild resolves it, at least in my case, for when building the binary.

FWIW (server_source.js is my entry point)

"scripts": {
    "build": "npm run do_esbuild && npm run do_pkgbuild",
    "do_esbuild": "esbuild server_source.js --bundle --outfile=server.js --platform=node --target=node18 --external:@serialport/* --external:@zwave-js/config --external:zwave-js/package.json",
    "do_pkgbuild": "pkg . --compress Brotli -t host --targets node18"
  },
"pkg": {
   "assets": "./node_modules/@serialport/bindings-cpp/prebuilds/**/*",
   "outputPath": "dist"
  }

@john159753
Copy link

I am seeing the same on my standalone install (no docker, just the exe as a service with nssm on windows). You shouldn't need any special configuration or setup to get it working, It just worked for me previously.

@robertsLando
Copy link
Member

@john159753 I agree with you but it's not that obvious, in order to package application I use a tool named pkg that does many things under the hoods that can create such issues that you don't see when running it without (like with docker, snap or nodejs).

This time the problem is related to the driver that starting from version 12 is using some ESM package that is not fully supported by pkg... I will try to see if I find a way to make it work... the alternative is to fix this on driver side someway like switching to a cjs version of got package like https://www.npmjs.com/package/got-cjs

@garbled1
Copy link
Author

Should this be converted to a bug then? I understand it might take you a bit to fix, but it's preventing me from doing fw updates on my nodes. Thank you for all your effort though, it's appreciated!

@robertsLando robertsLando added bug Something isn't working and removed question Further information is requested labels Nov 15, 2023
@robertsLando
Copy link
Member

@garbled1 Sure, done. A quick fix would be to simply try another deploy method like docker, snap or manually built.

@robertsLando
Copy link
Member

@garbled1 Would the new npm deploy method be an option for you?

@garbled1
Copy link
Author

I can take a look. My setup is a little complex, as I basically run it on a tiny VM, need to see how much needs to be installed to get npm running. npm is at least a better option for me than docker.

How can I convert my settings from the binary version to that? It seems to reference different files? (specifically the ZWAVEJS_EXTERNAL_CONFIG option)

@robertsLando
Copy link
Member

How can I convert my settings from the binary version to that? It seems to reference different files? (specifically the ZWAVEJS_EXTERNAL_CONFIG option)

Actually what you need to do is only to move everything you have in store directory to the new one or set as store path the store directory you are using now. Let's say you have your executable in folder xxx/zui, store folder should be xxx/zui/store, just set that as path in your pm2 config and you are done. In order to install npm you can use nvm

@robertsLando robertsLando changed the title Cannot perform OTA updates from zwave-js-ui Cannot perform OTA updates from zwave-js-ui from packaged application Nov 16, 2023
@robertsLando
Copy link
Member

robertsLando commented Dec 14, 2023

@AlCalzone about this, could you switch to got-cjs? Otherwise i could do a try to create the pkg file against the new introduced esbuild bundle that should work

@AlCalzone
Copy link
Member

Shouldn't this also be solved by esbuild bundling like Marcus wrote?

@robertsLando
Copy link
Member

robertsLando commented Dec 15, 2023

Yeah that's the alternative, the only problem with that is I would add another layer of "abstraction" to the pkg version

@robertsLando
Copy link
Member

robertsLando commented Dec 18, 2023

This should work in next version. In the meanwhile can anyone give a test to this?

Linux x64:
https://wormhole.app/xaAYX#uFh7zJJTN0AKNWGGe-qHOw

(This link will be valid until 12:00 CET of tomorrow 19/12/2023)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants