dehsgr / node-red-contrib-alphaess

This provides a node for retrieving information from Alpha ESS photovoltaic systems.
ISC License
14 stars 0 forks source link

node-red crash on deployment #1

Closed Medicalmusings closed 2 years ago

Medicalmusings commented 2 years ago

Really appreciate your efforts, this module is exactly what I need. Please keep going. However, I think I have found a bug. Sorry, I'm an Amateur programmer, not UNIX sleuth but I've managed to duplicate the following on two different machines/installations/operating systems so am suspicious:

Node-red v 2.13 running on Rasperian fully updated. Duplicated after updating to Node-red 2.2.0 Node js version v12.22.9 hosted on both raspberian AND MacOS Catalina. UI Interface Mac Safari, duplicated using Brave browser Have tried node-red running both as system process and user instance - same crash.

Symptoms: Node red running fine (both my operational system and a clean install). Add Alphaess module via Pallette. No issue. Drag module onto a new flow - no issue. AS SOON AS FLOW DEPLOYED - sometimes UI crash, usually server CRASH. Had to uninstall alphaess files manually to get node-red running again.

LOGS: Before the process died managed to catch the following:

crash

Looks like everything loaded nicely then failed 'Cannot read property 'AccessToken of null in image

This screenshot was from my long-running automation server on Raspberry pi (node-red running under PI) but I get exactly the same result running a pristine installation on a mac mini server with no other modules loaded. Have also duplicated this error after multiple reboots and reinstalls of the Alpha module.

Ideas?

dehsgr commented 2 years ago

@Medicalmusings I would like you to update to latest version of this node (v1.2.1). Afterwards the error should be catched and the server response should be logged to console. It would me help a lot if you would provide the logged server response here.

ATTENTION! The server response might contain sensitive information. Feel free to send the response to dehsgr[at]outlook[dot]com.

I'll handle your sensitive data carefully and will not save it longer than needed for debugging this issue.

Medicalmusings commented 2 years ago

OK repeated the problem exactly as before.

Running node-red 2.2, upgraded to your latest version and ran node. No modules loaded other than the default node red installation package. This is a test server I created so haven’t changed any node-red or node-js settings from installation default.

Added Alphaess 1.2.1 to flow 1, piped it to a message block with output to debug window whilst piping the console to a text file. As before on deployment node red server froze, I THINK it restarted itself once or twice (or at least the browser tried to reconnect) and then died.

God hunting. Really appreciate your time on this as if working this module would be incredibly helpful for me as I venture into home automation with node red.

Thanks

-Allan Palmer

The Log:

==================================================================================================

11 Feb 18:14:06 - [info]

Welcome to Node-RED

11 Feb 18:14:06 - [info] Node-RED version: v2.2.0 11 Feb 18:14:06 - [info] Node.js version: v16.13.2 11 Feb 18:14:06 - [info] Darwin 19.6.0 x64 LE 11 Feb 18:14:07 - [info] Loading palette nodes 11 Feb 18:14:08 - [info] Settings file : /Users/Allan/.node-red/settings.js 11 Feb 18:14:08 - [info] Context store : 'default' [module=memory] 11 Feb 18:14:08 - [info] User directory : /Users/Allan/.node-red 11 Feb 18:14:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 11 Feb 18:14:08 - [info] Flows file : /Users/Allan/.node-red/restart 11 Feb 18:14:08 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials.

You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

11 Feb 18:14:08 - [info] Server now running at http://127.0.0.1:1880/ 11 Feb 18:14:08 - [info] Starting flows 11 Feb 18:14:08 - [info] Started flows 11 Feb 18:17:36 - [info] Stopping flows 11 Feb 18:17:36 - [info] Stopped flows 11 Feb 18:17:36 - [info] Starting flows 11 Feb 18:17:36 - [info] [alphaess-monitoring:Alpha ESS] Logging in... 11 Feb 18:17:37 - [info] Started flows 11 Feb 18:17:47 - [red] Uncaught Exception: 11 Feb 18:17:47 - [error] TypeError: Cannot read properties of null (reading 'pmeter_l1') at Request._callback (/Users/Allan/.node-red/node_modules/node-red-contrib-alphaess/alphaess-monitoring.js:195:18) at Request.self.callback (/Users/Allan/.node-red/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request. (/Users/Allan/.node-red/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at IncomingMessage. (/Users/Allan/.node-red/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)

On 6 Feb 2022, at 6:27 pm, dehsgr @.***> wrote:

@Medicalmusings https://github.com/Medicalmusings I would like you to update to latest version of this node (v1.2.1). Afterwards the error should be catched and the server response should be logged to console. It would me help a lot if you would provide the logged server response here.

ATTENTION! The server response might contain sensitive information. Feel free to send the response to dehsgr[at]outlook[dot]com.

I'll handle your sensitive data carefully and will not save it longer than needed for debugging this issue.

— Reply to this email directly, view it on GitHub https://github.com/dehsgr/node-red-contrib-alphaess/issues/1#issuecomment-1030776261, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFIEXVNPA5HNYQPYSQF6BTUZYWGNANCNFSM5NUVU3PA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

dehsgr commented 2 years ago

@Medicalmusings this is your problem:

11 Feb 18:17:47 - [error] TypeError: Cannot read properties of null (_reading 'pmeter_l1'_)

dehsgr commented 2 years ago

@Medicalmusings but stop! Wait! I just have an idea! Guest access should not be needed...

dehsgr commented 2 years ago

@Medicalmusings please try again with v1.2.2 and give feedback here...

Medicalmusings commented 2 years ago

Updated to 1.2.2, looks like same error.

Cant see anywhere I can give you guest access. Switch to email (have cc’d your email so you will capture mine)?

--Allan Palmer

11 Feb 19:15:28 - [info] Server now running at http://127.0.0.1:1880/ 11 Feb 19:15:28 - [info] Starting flows 11 Feb 19:15:28 - [info] Started flows 11 Feb 19:17:10 - [info] Stopping flows 11 Feb 19:17:10 - [info] Stopped flows 11 Feb 19:17:10 - [info] Starting flows 11 Feb 19:17:11 - [info] [alphaess-monitoring:wombat] Logging in... 11 Feb 19:17:13 - [info] Started flows 11 Feb 19:17:23 - [red] Uncaught Exception: 11 Feb 19:17:23 - [error] TypeError: Cannot read properties of null (reading 'pmeter_l1') at Request._callback (/Users/Allan/.node-red/node_modules/node-red-contrib-alphaess/alphaess-monitoring.js:195:19) at Request.self.callback (/Users/Allan/.node-red/node_modules/request/request.js:185:22) at Request.emit (node:events:390:28) at Request. (/Users/Allan/.node-red/node_modules/request/request.js:1154:10) at Request.emit (node:events:390:28) at IncomingMessage. (/Users/Allan/.node-red/node_modules/request/request.js:1076:12) at Object.onceWrapper (node:events:509:28) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)

On 11 Feb 2022, at 6:58 pm, dehsgr @.***> wrote:

@Medicalmusings https://github.com/Medicalmusings please try again with v1.2.2 and give feedback here...

— Reply to this email directly, view it on GitHub https://github.com/dehsgr/node-red-contrib-alphaess/issues/1#issuecomment-1035995212, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADFIEXRV7Y7RTFSURCRCJ6LU2TFSRANCNFSM5NUVU3PA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.

dehsgr commented 2 years ago

@Medicalmusings switched over to mail now. Thanks for CC-ing.

dehsgr commented 2 years ago

Okay. The response from Alpha ESS for the real time data was empty and causing this issue. I just released v1.2.5 with a fix. Thanks for reporting and supporting me in finding the source reason.