ptarmiganlabs/butler-cw

enigmaOpen error: {}

fallenangel321 opened this issue · 4 comments

Hello,
First of all, thanks so much for this work, it's very helpful. I am running into an issue shown in the attached image. Basically, when an app is scheduled to run, at every specified time it runs, there is an enigmaOpen error, but with no message:

error: enigmaOpen error: {}

Can you help me or at least explain to me why this is happening / if you've seen this before? The error is thrown at line 56:

 try {
        g = await s.open();
    } catch (err) {
        globals.logger.log('error', `enigmaOpen error: ${JSON.stringify(err)}`);
        return;
    }

enigmaError

The strange thing is that if doInitialLoad is set to "true" - it runs the first time successfully, but everything on the scheduler does not with the above message.

I have tried running natively as well as in docker, but the same issue happens.

I debugged through index.js at that line that calls "await s.open". Looking closer at the err object, i found:

getaddrinfo ENOTFOUND - which led me to the "server" attribute in the apps.yaml. I'll mark this closed, but wanted to leave this here in case someone runs into this. This was difficult to find since the start-up ran correctly, but the schedule didn't work, so not sure what happened there.

Thanks for reporting it and good that you solved it.

Do I understand you correctly that the errors were caused by some incorrect value in the apps.yaml file?

I am sure we could add better error checking to Butler CW in general... Having good, descriptive error messages is always good of course.

On the roadmap is also to create standalone binaries of Butler CW. That would make it simpler to deploy (no need to install Node.js first), easier to run as a Windows service etc.
This has been done for some of the other Butler tools with excellent results, so it just might be coming to Butler CW too...

I appreciate the quick response, thanks for your work on this project, it's going to be a big help to us.

Yes, I debugged through VS Code and I found that it was the "server" value that was incorrect. The strange thing is that it worked on startup, so I'm not sure why it's different.

Anyway I originally had:
https://server.mycompany.com

Where I actually just needed:
server.mycompany.com

Once I saw the actual underlying error message that helped direct me.

Ah yes... that field in the config apps.yaml file expects a host name or IP address, rather than a URL.

I looked at the README at https://github.com/ptarmiganlabs/butler-cw and it does mention that the server field should be an IP or Fully Qualified Domain Name (FQDN):

...
# Fields for each app:
# server: IP or FQDN of the Sense server where the app should be loaded
# appId: Id of app to load
# appDescription: Free text description of the app. Can be anything - no check is done Sense APIs using this text
# appStepThroughSheets: Set to true to have Butler CW step through all sheets of the app, triggering all charts etc to calculate in all sheets
# doInitialLoad: Set to true to do an initial load of this app when Butler CW is started.
# freq: Text value representation of how often the app should be loaded
...

Anyway - good that you got it working - well done!