Skip to content
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

If no configuration found, or adapter was not properly installed, check it. #2418

Merged
merged 5 commits into from
Sep 20, 2023

Conversation

GermanBluefox
Copy link
Contributor

You can reproduce this error when starts the adapter, that does not even added to iobroker.

@foxriver76
Copy link
Collaborator

Do we really want to support this?

should already terminate here

if (fs.existsSync(`${this.adapterDir}/io-package.json`)) {
why this does not happen there?

@GermanBluefox
Copy link
Contributor Author

GermanBluefox commented Sep 5, 2023

Do we really want to support this?

should already terminate here

if (fs.existsSync(`${this.adapterDir}/io-package.json`)) {

why this does not happen there?

I have no Idea. But with the latest version I have this:
image

hm-rega has no instances and no system.adapter.hm-rega objects

With these changes the output looks better:
image

@foxriver76
Copy link
Collaborator

foxriver76 commented Sep 6, 2023

the root problem is that adapter dir is not found in such a scenario, so would need to plug in their. However it should basically exit then - else the question for me is if we really need to support this scenario, we have a few better ways to debug a adapter nowadays.

@GermanBluefox
Copy link
Contributor Author

So add at least this.ioPack?.common?.plugins to ignore the error

@foxriver76
Copy link
Collaborator

You can easily pass around it, by providing the actual adapterDir to the adapter constructor. Then we also don't have broken functionality in other places, because as stated in a productive scenario the adapter would have already been shut down.

Else, we can implement some special logic to set the adapter dir, just like the host name for dev purposes like https://github.com/ioBroker/ioBroker.js-controller/blob/ff6975303d61f04653686fcde3284baab3f62485/packages/common/src/lib/common/tools.ts#L1574C1-L1576C6

@GermanBluefox
Copy link
Contributor Author

You can easily pass around it, by providing the actual adapterDir to the adapter constructor.

By every adapter I develop? 100 or so? It is immposible

@GermanBluefox
Copy link
Contributor Author

We are discussing here about 2 question marks, that will save me tons of hours. Isn't that absurd?

@foxriver76
Copy link
Collaborator

We are discussing here about 2 question marks, that will save me tons of hours. Isn't that absurd?

As soon as I understand how exactly you debug to even get this running, we will find a way, no problem with adding the question mark, even if I think there are more straight forward ways to debug. And currently I am not sure and cannot assess if it will save you tons of hours or will end up in a need for other workarounds later on to get the setup of one dev running.

I now tried two scenarios to reproduce (Adapter not added to ioBroker as stated by you in the initial post):

One started the adapter from workspace one from node modules but still not added to ioBroker, as expected, both fail. So how can I reproduce it?

image

@GermanBluefox
Copy link
Contributor Author

scenarios to reproduce:
js-controller folder: c:/pWork/node_modules/iobroker.js-controller
hm-rega folder: c:/pWork/iobroker.hm-rega
By start of cd c:/pWork/iobroker.hm-rega && node main.js --debug I got
image

@foxriver76
Copy link
Collaborator

ah so its more about controller debugging and not adapter debugging of course then we have no dev-server yet. I think in general like in main.ts we should not crash just because we could not initalize plugins, so added try/catch around it.

maybe someday with #2161

@foxriver76 foxriver76 merged commit ef3265a into master Sep 20, 2023
13 checks passed
@foxriver76 foxriver76 deleted the detect-not-installed branch September 20, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants