bartbutenaers / node-red-contrib-onvif-nodes

Node Red nodes for communicating with OnVif compliant IP devices
Apache License 2.0
65 stars 25 forks source link

TypeError: Cannot read property 'action' of null #31

Open nygma2004 opened 2 years ago

nygma2004 commented 2 years ago

I installed the latest version of onvif-nodes, testing it on an Annke C800. I had connection issues initially, which I resolved. I got this error message when I run the onvif-media, but for example I can use onvif-device without any issues.

Maybe it is related to C800. Probably I can also use simple HTTP request as well, but I may just document it here in case you want to pick it up at some point:

18 Jan 22:14:30 - [error] [onvif-media:ddb99a63.98e938] Cannot read property 'action' of null
18 Jan 22:14:30 - [red] Uncaught Exception:
18 Jan 22:14:30 - [error] TypeError: Cannot read property 'action' of null
    at Object.exports.handleResult (/home/nygma/.node-red/node_modules/node-red-contrib-onvif-nodes/utils.js:70:20)
    at Cam.<anonymous> (/home/nygma/.node-red/node_modules/node-red-contrib-onvif-nodes/onvif_media.js:236:39)
    at Cam.<anonymous> (/home/nygma/.node-red/node_modules/onvif/lib/media.js:1127:15)
    at parseSOAPString (/home/nygma/.node-red/node_modules/onvif/lib/utils.js:108:3)
    at IncomingMessage.<anonymous> (/home/nygma/.node-red/node_modules/onvif/lib/cam.js:246:4)
    at IncomingMessage.emit (events.js:412:35)
    at endReadableNT (internal/streams/readable.js:1334:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.
nodered.service: Consumed 17.664s CPU time.
bartbutenaers commented 2 years ago

Hi @nygma2004,

Sorry for the delay. Very busy with personal stuff at the moment... I implemented quickly a fix on Github, but I haven't tested it yet myself. So not sure if it will work... Would be nice if you could implement the fix and test it!
You can install it like this from my Github repository (from within your .node-red folder):

npm install bartbutenaers/node-red-contrib-onvif-nodes

Thanks!! Bart

nygma2004 commented 2 years ago

Hi @bartbutenaers

No worries, I know you are very busy as usual. I ran the npm install, restarted node-red and it is not dumping any more. But I think something is really broken with this C800. When I set it to get snapshot URI, I get the URI back. When I set the action get snapshot image, nothing happens and I see a socket hang up message in node-red-log. I also tested your example of getting the URI and calling that URL in a simple HTTP Request node. And the same thing happens, I get a socket hang up in the log.

Also if I call the URI from Chrome http://192.168.1.210/onvif-http/snapshot?Profile_1 I get a login prompt, I enter the u/p for onvif access and nothing happens. Chrome gives up after half a minute with a ERR_EMPTY_RESPONSE.

I think I will try to raise this in the Annke forum and see what happens.