jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

crash after any TTS request #721

Closed mishashch closed 4 years ago

mishashch commented 4 years ago

Hi,

just installed node.js+Node Sonos Http Api. I can successfully check zones, change volume, change the track with next. But as soon as any TTS request is sent server crashes.

Output is:

d:\incom\jishi-node-sonos-http-api-0d03be9\lib\helpers\is-radio-or-line-in.js:4 return uri.startsWith('x-sonosapi-stream:') || ^

TypeError: Cannot read property 'startsWith' of undefined at isRadioOrLineIn (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\helpers\is-radio-or-line-in.js:4:14) at Object.say (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\actions\say_v2.js:64:12) at handleAction (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\sonos-http-api.js:110:35) at HttpAPI.requestHandler (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\sonos-http-api.js:87:5) at d:\incom\jishi-node-sonos-http-api-0d03be9\server.js:80:13 at Server.finish (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:111:13) at finish (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:170:14) at d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:144:17 at FSReqWrap.oncomplete (fs.js:153:21) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sonos-http-api@1.0.1 start: node server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sonos-http-api@1.0.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\mike\AppData\Roaming\npm-cache_logs\2019-09-29T17_40_42_214Z-debug.log

d:\incom\jishi-node-sonos-http-api-0d03be9>

There is also a error message while start but it doesn't crash the server:

sonos-http-api@1.0.1 start d:\incom\jishi-node-sonos-http-api-0d03be9 node server.js

2019-09-29T17:39:11.136Z INFO Presets loaded: { example: { players: [ { roomName: 'Bathroom', volume: 10 }, { roomName: 'Kitchen', volume: 10 }, { roomName: 'Office', volume: 10 }, { roomName: 'Bedroom', volume: 10 }, { roomName: 'TV Room', volume: 15 } ], playMode: { shuffle: true, repeat: 'all', crossfade: false }, pauseOthers: false, favorite: 'My example favorite' } } 2019-09-29T17:39:11.148Z INFO http server listening on port 5005 2019-09-29T17:39:11.545Z ERROR TypeError: Cannot read property 'startsWith' of undefined at isRadio (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\prototypes\Player\getUriType.js:4:14) at Player.getUriType (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\prototypes\Player\getUriType.js:18:10) at parseTrackMetadata.then.track (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\models\Player.js:243:43) at process._tickCallback (internal/process/next_tick.js:68:7)

Debug file is not really informative. But it is attached here. 2019-09-29T17_40_42_214Z-debug.log

Same behaviour is seen both in Raspberry and in Win10. What is wrong? And how to fix it?

jishi commented 4 years ago

You are running an awfully old version of the http-api (and probably the Sonos-discovery package). Could you try upgrading it? Checkout the latest master or download it and run npm install to get the latest dependencies.

On Sun, 29 Sep 2019, 19:59 mishashch, notifications@github.com wrote:

Hi,

just installed node.js+Node Sonos Http Api. I can successfully check zones, change volume, change the track with next. But as soon as any TTS request is sent server crashes.

Output is:

d:\incom\jishi-node-sonos-http-api-0d03be9\lib\helpers\is-radio-or-line-in.js:4 return uri.startsWith('x-sonosapi-stream:') || ^

TypeError: Cannot read property 'startsWith' of undefined at isRadioOrLineIn (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\helpers\is-radio-or-line-in.js:4:14) at Object.say (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\actions\say_v2.js:64:12) at handleAction (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\sonos-http-api.js:110:35) at HttpAPI.requestHandler (d:\incom\jishi-node-sonos-http-api-0d03be9\lib\sonos-http-api.js:87:5) at d:\incom\jishi-node-sonos-http-api-0d03be9\server.js:80:13 at Server.finish (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:111:13) at finish (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:170:14) at d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\node-static\lib\node-static.js:144:17 at FSReqWrap.oncomplete (fs.js:153:21) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sonos-http-api@1.0.1 start: node server.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the sonos-http-api@1.0.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\mike\AppData\Roaming\npm-cache_logs\2019-09-29T17_40_42_214Z-debug.log

d:\incom\jishi-node-sonos-http-api-0d03be9>

There is also a error message while start but it doesn't crash the server:

sonos-http-api@1.0.1 start d:\incom\jishi-node-sonos-http-api-0d03be9 node server.js

2019-09-29T17:39:11.136Z INFO Presets loaded: { example: { players: [ { roomName: 'Bathroom', volume: 10 }, { roomName: 'Kitchen', volume: 10 }, { roomName: 'Office', volume: 10 }, { roomName: 'Bedroom', volume: 10 }, { roomName: 'TV Room', volume: 15 } ], playMode: { shuffle: true, repeat: 'all', crossfade: false }, pauseOthers: false, favorite: 'My example favorite' } } 2019-09-29T17:39:11.148Z INFO http server listening on port 5005 2019-09-29T17:39:11.545Z ERROR TypeError: Cannot read property 'startsWith' of undefined at isRadio (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\prototypes\Player\getUriType.js:4:14) at Player.getUriType (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\prototypes\Player\getUriType.js:18:10) at parseTrackMetadata.then.track (d:\incom\jishi-node-sonos-http-api-0d03be9\node_modules\sonos-discovery\lib\models\Player.js:243:43) at process._tickCallback (internal/process/next_tick.js:68:7)

Debug file is not really informative. But it is attached here. 2019-09-29T17_40_42_214Z-debug.log https://github.com/jishi/node-sonos-http-api/files/3667832/2019-09-29T17_40_42_214Z-debug.log

Same behaviour is seen both in Raspberry and in Win10. What is wrong? And how to fix it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/721?email_source=notifications&email_token=AAYE2I6RRFG5IFAN6BNHY5DQMDUJ3A5CNFSM4I3TMNQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HOMTYPA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYE2IZQWNHIJQWQFJJBGR3QMDUJ3ANCNFSM4I3TMNQQ .

mishashch commented 4 years ago

You are right. My fault. I've downloaded an archive from http://jishi.github.io/node-sonos-http-api/ which is provided at the top of main page and didn't check the version. After downloading the right version everything is working fine. Thanks.