home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.99k stars 31.03k forks source link

zwave-js-server require is not defined error in 1.40.2 #131399

Open umglurf opened 3 days ago

umglurf commented 3 days ago

The problem

After upgrading to zwave-js-server 1.40.2, when trying to lock or unlock my Danalock zwave doorlock, zwave-js-server fails with the following error:

zwave-server[153]: Unexpected error ReferenceError: require is not defined
zwave-server[153]:     at __assertType (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/cc/build/esm/cc/DoorLockCC.js:36:45)
zwave-server[153]:     at Proxy.set (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/cc/build/esm/cc/DoorLockCC.js:526:13)
zwave-server[153]:     at Proxy.<anonymous> (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/cc/src/cc/DoorLockCC.ts:372:31)
zwave-server[153]:     at ZWaveNode.setValue (file:///opt/homeassistant/zwave-js/node_modules/zwave-js/src/lib/node/Node.ts:666:39)
zwave-server[153]:     at NodeMessageHandler.handle (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/server/dist-esm/lib/node/message_handler.js:23:43)
zwave-server[153]:     at Client.receiveMessage (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/server/dist-esm/lib/server.js:133:100)
zwave-server[153]:     at WebSocket.<anonymous> (file:///opt/homeassistant/zwave-js/node_modules/@zwave-js/server/dist-esm/lib/server.js:54:45)
zwave-server[153]:     at WebSocket.emit (node:events:517:28)
zwave-server[153]:     at Receiver.receiverOnMessage (/opt/homeassistant/zwave-js/node_modules/ws/lib/websocket.js:1220:20)
zwave-server[153]:     at Receiver.emit (node:events:517:28)

When downgrading to 1.40.0, it works again

What version of Home Assistant Core has the issue?

core-2024.11.3

What was the last working version of Home Assistant Core?

core-2024.11.3

What type of installation are you running?

Home Assistant Container

Integration causing the issue

z-wave

Link to integration documentation on our website

https://www.home-assistant.io/integrations/zwave_js

Diagnostics information

home-assistant_zwave_js_2024-11-23T19-26-03.817Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 3 days ago

Hey there @home-assistant/z-wave, mind taking a look at this issue as it has been labeled with an integration (zwave_js) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zwave_js` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zwave_js` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zwave_js documentation zwave_js source (message by IssueLinks)

AlCalzone commented 2 days ago

Are you building the container yourself? If so, you need to bump the version of node-zwave-js to 14.3.6

umglurf commented 2 days ago

Hi @AlCalzone

I've installed zwave-js-server using npm on a separate server. I see that the package.json declares

"peerDependencies": {

    "zwave-js": "^14.0.0"

  },

It sounds like that needs to be updated, so that installing zwave-js-server pulls in the correct version. I will test upgrading it manually later today.

AlCalzone commented 2 days ago

Correct

umglurf commented 2 days ago

I've updated zwave-js and verified that it then works