-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
External Converters Loading Stopping at errors #26763
Comments
@ivanfmartinez please read this #24198 |
@mrmaximas the problem that I related is not about the illuminance, is about not loading other converters after one converter gives exception. That converter with illuminance errors is just an older converter that I dont need anymore, but as they still on the directory it breaks the load of other converter. I'm not reporting the error with illuminance converter, I just showed an example that is the only error show, but the other converter that are correct are not loaded. |
@ivanfmartinez how about this? External converters and extensions |
@mrmaximas I'm using the .js files in the data/external_converters directory since I migrate to 2.x series. You still did not understand what I reported here. I had 3 js files in that directory data/external_conversters directory The first one was loaded correctly because was OK. AFTER I removed the file with error or resolved the error on that file the other file was loaded correctly. I have showed that the code that load all exception is a single for loop which does not check for exceptions and the loading of single JS throw an error, and this will break the for loop that try to load all js files, without an explicity message indicating that the loading of all js files stopped I spend some time to understand what is happening. It should not stop loading other js when one have errors, or at least should give a clear indication that will not load others. In my case now I understand the case, but someone else can be in this case later, and I understand that this should be at least
For reference this is my timelime why I did not find that on first upgrade to 2.x |
Will be fixed once https://github.com/Nerivec/zigbee2mqtt/commits/externaljs-dynamic-import is merged. |
What happened?
After upgrading to 2.x one of my devices stopped working (As it was a device that i did not use normally I did not see this before), the device shows as unsupported but no error for this external converter are show on the log.
But there was an error related to an old device that I did not use anymore.
After some checking I found that when one external converter fails to load the others are not loaded.
Looking at the code as this is a generic JS class the problem can happen at other places
Here de load of all JS files a single for iterating over the files, with no error check
zigbee2mqtt/lib/extension/externalJS.ts
Line 154 in 6d6372c
Here the load of a single external converter which log the error and throw and this is cancelling the load all loop
zigbee2mqtt/lib/extension/externalConverters.ts
Line 42 in 6d6372c
What did you expect to happen?
Only the faulty external converter should not be load and all others can be loaded.
How to reproduce it (minimal and precise)
Create 2 external converters that are valid, check on the log what order they are loaded.
Change the first one to have an error.
restart z2m, it should load one and skip the one with error, but none are loaded.
The test code are using only valid converters and loading one at a time. Should have option to load all and have invalid converter also
zigbee2mqtt/test/extensions/externalConverters.test.ts
Line 121 in 6d6372c
Zigbee2MQTT version
2.1.3
Adapter firmware version
20230507
Adapter
sonoff
Setup
docker container, but I think this will happen on any setup
Debug log
This error was for the external converter with error, but the problem is that others that should be loaded after this are skipped.
The text was updated successfully, but these errors were encountered: