The value in msg.topic is defined, but in the function the variable topic is not the same as msg.topic. So in the line topic = msg.payload.country
you could have used foo = msg.payload.country
and since you have not defined foo you would get an error.
If you were using 'foo' the return would be return {filename:filename,topic:foo};
I'm confused. the variable topic is being set, nothing undefined about it, unless it is not set and it ends up at return with an undefined variable, ie. if it was not setup correctly. Because your suggestion only captures the error that is thrown, it would still not work.
There is a bug in your code but I know why I am seeing it and you are not.
Assume that the incoming msg does not have a msg.payload.category and msg.payload.category and msg.payload.search. in that case the first and second IF statements are false and the variable topic will not exist. Since msg.payload.search also does not exist, the third IF statement will result in a TRUE condition and it will try to return a msg using wat is in a variable topic that has never been set causing the topic is not defined error to pop up in the debug. Adding the var topic = ''; removes this error from happening in this situation.
Now for the reason this is happening. (notice that I am the second person to report this error). It has to do with messing up the install. In my case (due to another issue I'm looking into) the files were installed in a different folder than is needed, so I was getting the default uibuilder page. Clicking the 'increment' button will cause the error to show up.
The addition of the one line of code to the function will prevent the error from occurring.
While using Watch IPTV I got some issues. Such as:
After the last update of "uibuilder' to the version 2.0.6 the app stopped working. I had to get back to the version 2.0.5. Were there any breaking changes?
Has anyone found matching browser which works natively with HLS stream? Except Safari.
Maybe the question doesn't belong to this particular theme, but maybe you could answer me. I'm trying to give an access to the "watch IPTV" from the outside of my network. I'm using reverse proxy server Caddy. But somehow only the first page could be opened. In the debugging regime Chrome F12 I can see a lot of mistakes.
Refused to apply style from 'https://[myaddress].duckdns.org/uibuilder/vendor/bootstrap-vue/dist/bootstrap-vue.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.Refused to apply style from 'https://[myaddress].duckdns.org/uibuilder/vendor/bootstrap-vue/dist/bootstrap-vue.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Failed to load resource: the server responded with a status of 404 ()
Not that I am aware of. Are there any errors showing either in the Node-RED log or the browser console?
You can always see the changes on the Releases page:
Also, if you click on the code in the left margin for a release, you will get all of the actual changes since the previous release - the CHANGELOG file also contains a link that will show you those.
Release page: Changelog:
The CSS warnings are because you don't have type="text/css" on your CSS links in the index.html file. This changed with a version update of Node-RED at some point and relates to the ExpressJS app servers created.
We need to know which resource this is. If you open the network tab of your browser and reload the page, you should be able to spot it easily enough.
You might also want to share at least the outline of your html.