-
Notifications
You must be signed in to change notification settings - Fork 12
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
[Bug]: Since the update to node.js 16 playing radio stations via script does not work #124
Comments
Good question ... seems that no connection to the device could be established and thats why noheraders exist ... and the used lib is not checking that correctly |
Could perhaps the update to NodeJs 16 and NPM 8 be the cause of this phenomenon, I am at a loss? |
Ok, I was able to reprod it by going back to nodeJs 14. Cause with that it works again, so I guess that's what it is. I hope you can do something with it and find a solution. Until then I will stay with NodeJs 14. |
A debug log would been very helpfull ... I do not have a Chromecast, so I can not test myself |
The log above is a debug log ¯\ (ツ)/¯ |
In fact, i'm back to NodeJS 14 and pushed de chromecast to a slave with NodeJS 16.x and NPM 8.x.
|
But this is an installation error ... run "iob install chromecast@2.3.1 --debug" on that host in cli and you will see the real npm error |
hier genau das gleiche im debug log :( `chromecast.0 | 2022-06-30 08:06:22.677 | error | Badezimmer - Cannot play file "http://live.antenne.at/ak.mp3": TypeError: Cannot use 'in' operator to search for 'content-type' in undefined chromecast.0 | 2022-06-30 08:06:22.677 | error | Badezimmer - Error playing playlist - TypeError: Cannot use 'in' operator to search for 'content-type' in undefined at MediaInfo._parseIcyHeaderPromise (/opt/iobroker/node_modules/castv2-player/lib/mediaInfo.js:143:26) at /opt/iobroker/node_modules/castv2-player/lib/mediaInfo.js:47:43 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Promise.all (index 1) chromecast.0 | 2022-06-30 08:06:22.676 | info | Badezimmer - Closing mediaInfo |
Now the four logs for every scenario, hope someone could help me:
3. installed chromecast adapter from clithomas@iobroker:~$ iob install chromecast@2.3.1 --debug added 212 packages, removed 4 packages, and changed 3 packages in 13s 151 packages are looking for funding 4. installed an instancechromecast.0 2022-07-01 14:45:29.284 warn This object will not be created in future versions. Please report this to the developer. 5. I played radio station via scriptchromecast.0 2022-07-01 14:57:52.111 info Büro - getStatus 6. I put the radiostation in state chromecast.0.device.player.url2play
|
|
Hi, I think this is a duplicate/same issue I have created. I made a local fix for me so if you want a quickfix you can change just one file on your PI. Just go into this file with vi/nano or something you are using to edit files (/opt/iobroker/node_modules/castv2-player/lib/mediaInfo.js): Line 143:
to:
Line 174:
to:
I posted this in the facebook group too. I think the http API or the "in" operator changed with the new node Version. |
Great, it made my day. This fix is working. Unfortunately, I am not a programmer. Maybe a developer can put this into a new adapter version. |
I was not sure if this should just be a "quickfix" for me because I think there should be headers in the response so someone from the creaters or contributors that knows exactly the code and what is expected should maintain it. I just did it for me because I don't wanna downgrade the node version again :D |
Unfortunately, the last radio station is now also played when there was a voice output on this device. A better fix is clearly needed |
But that is the same behaviour as before. Radio is running, voice command comes in and than radio starts again. For me that is an expected and wanted behaviour. This was with node 14 the same. |
Yes but this is not the real fix ... wenn "res.headers" nicht da ist dann stimmt irgendwas nicht mit der Antwort ... geht denn sonst alles? |
After reading some code in castv2-player etc I think it's related to this nodejs/node#35281 |
Ok, after restarting the device, the last station is no longer loaded. So the fix works after all. |
@aortmannm can you adjust the code and log the headers completely? |
Code
Log
res.headers is undefined. I can't output the hole response object, than it's just [Object object]. With JSON.stringify it's crashing. Right now I don't know how to start a debug session for an ioBroker Adapter. |
Ok, I used now util.inspect(res)
There is a property rawHeaders...probably this could be used. |
I personally think more that the "forwarding res" like https://github.com/iobroker-community-adapters/castv2-player/blob/1192bebe66b39bf7c4840f6579a848435dff4fea/lib/mediaInfo.js#L77 does breaks that "lazy evaluation of headers somehow. Can you please try to find this on your system and log res.headers here too? I assume it works there ... if it is this my proposed fiy owould be to get headers there and pass that instead of res ... |
Aahh I thought you added the log there where the exception occurs. The interetsing thing is that the line here "that._url = res.headers.location" can access a res.headers field without any issues, but in the other method not. And also you "log of res.headers" did not worked ... So yes sit seems to be all caused by that "headers is somehow build lazy in Node.js 16 with getters which causes effects |
PS: Please try to log "res.headers['content-type']" ... does that work? |
Apollon the changes in line 74 are not corredct. The adapter crashes with the line:
I juse now:
So we need to update the code again. |
Yes but I see now it's still not working. To play a online radio it's working but when using the sayIt adapters it crashes now ;/. So it seems like we have two different uses of the res object or how we get them from the differen node modules ;/ . A second ago I added this code:
I think we become two different types of res objects, one from the icy npm module and one of another one. I will check if this works the next few days for me. Seems to work for both but mh I'm not sure if it's the way we should go. |
Ok, dann versuch mal Zeile 77 ändern von
in
|
I updated my comment above. I did something like this before the if statement because there we also need the right headers. |
Ok, also an idea. In fact modifying the object in that way can lead to any other issues in later versions of node.hjs but if it works we can do it that way. You tell what works best |
Ok, so seems to work well the last days. So you can take the Codeblock of my last comment. |
just upgraded to node.js 16 and had the same issue. works now with the changed code block (beginning at line 71 of mediaInfo.js ) mentioned above
|
DOn't know why it;s not released right now @Apollon77 |
Yes, I'm interested in that too. I would like to install this improvement in a stable version and I apologize for the urgency. |
As soon ad I find time I will adjust it officially. Will happen in the next days. |
I know you are one of the busiest and just wanted to make sure it wasn't forgotten. Again, I apologize for my actions. And yes, I am aware that I am already cutting into your time again with this statement, sorry. |
Hi Guys, any planes to publish / deploy this quick fix during the next days? Cant wait to get my chromecast speaker working again... plz @Apollon77 |
Yes it is on the "before myvacation list" ... lets see |
Ok, I now updated the library and prepared also an update here on GitHub ... so please try GitHub version and report please |
upgraded from version 2.3.1 to 3.0.0. with github but instance is not running anymore. i always get the error message "net-tools" not found but it is installed. `
` |
Can you show that please too? |
Hm ... and are you sure that te error came after the update? Inthe GitHub version line 622 is something else ... Please check again that the update was installed and adapter restarted afterwards |
When I install from github, I get version 3.0.1, but that is something completely different from 2.3.1. Two more adapters are needed and the objects must be deleted before the update, because now the devices are found by their mac addresses. In addition, all scripts have to be adapted, which I actually wanted to avoid until now. |
Ok, I don't have problems with the 3.0.1 sayIt and Playing Radio stations works for me |
@aortmannm with the new 3.0.1 from guthib or with the manually adjusted version? If manually: please reinstall from github to verify it still works :-) @meistermopper All good, will be next official version ...so changes will come |
@Apollon77 with github Version 3.0.1 :) |
@aortmannm then I wait if anyone more of the "mee too" guys from above find time to check snd will release tomorrow or such |
You Need to install the "net-tools" Adapter before you can create a chromecast instance since V3.0.0 . |
but why do i have the error message only in the expert mode ? and net-tools seems to be installed already:
|
net-tools is an ioBroker Adapter |
ok was not clear to me and could not find a hint to it. a lot of warnings in the logs about wrong type and "This object will not be created in future versions. Please report this to the developer." thanks to all |
Can I please get the full list of these "the object ..." errors as a debug log please as own issue? Then I can look into it. |
then lets release it ... will be funny for sure :-) 3.0.3 on it's way to beta |
Contact Details
No response
What happened?
Actually i deleted the adapter and the object tree, but it did nothing.
Adapter Version
2.3.1
JS-Controller Version
4.0.23
Node JS Version
16.15.1
NPM Version
8.11.0
Operating System
Debian
Relevant log output
Anything else?
No response
The text was updated successfully, but these errors were encountered: