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

clip errors on pi5 #888

Open crissmil opened 2 months ago

crissmil commented 2 months ago

Hi @jishi! thanks again for your api which I'm using from so many years. I have a strange issue with my new pi5 Debian GNU/Linux Bookworm (12) installation. clip and clippreset are stopping the server as per below. however say and saypreset are still working as expected. Any hints on this?

node:_http_server:345 throw new ERR_HTTP_HEADERS_SENT('write'); ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot write headers after they are sent to the client at ServerResponse.writeHead (node:_http_server:345:11) at Server.finish (/home/cristi/TTS server/node_modules/node-static/lib/node-static.js:125:17) at finish (/home/cristi/TTS server/node_modules/node-static/lib/node-static.js:170:14) at /home/cristi/TTS server/node_modules/node-static/lib/node-static.js:337:13 at streamFile (/home/cristi/TTS server/node_modules/node-static/lib/node-static.js:382:13) at ReadStream. (/home/cristi/TTS server/node_modules/node-static/lib/node-static.js:375:17) at ReadStream.emit (node:events:518:28) at ReadStream.emit (node:domain:488:12) at emitCloseNT (node:internal/streams/destroy:147:10) at process.processTicksAndRejections (node:internal/process/task_queues:81:21) { code: 'ERR_HTTP_HEADERS_SENT' }

Node.js v20.12.2

jishi commented 1 month ago

Sounds related to this: https://github.com/cloudhead/node-static/issues/241

Seems like the consumer you are using is issuing a ranged request and the node-static library doesn't deal with this properly, and seems like there is no viable fix (also, node-static seems a bit abandoned).

node-static is only used for serving clips and tts files (and also the documentation) so any static implementation (or just implement it yourself) should do. I don't really have time to do it right now though, but I would accept a decent PR for it.