"Error: Invalid "keyPath" option supplied."

821 views
Skip to first unread message

sama...@gmail.com

unread,
Mar 14, 2017, 6:31:34 PM3/14/17
to Node-RED

Hello,

I have problem to set the keypath in Node-RED.

The installation directory of Node-RED is

/root/.node-red

The start of Node-RED application is from

/root/app

The security certificates, keys and root-CA files are stored in

/root/app/certs

The problem is whatever I set the path to the security files I get the error message "Error: Invalid "keyPath" option supplied.".
I get the same error message even when I copied the folder /certs to be in the installation directory of Node-RED.

/root/.node-red/certs

My question is: How to specify the path so that Node-RED can accept it to find the security files?


Julian Knight

unread,
Mar 15, 2017, 8:07:44 PM3/15/17
to Node-RED

Graph Sam

unread,
Mar 19, 2017, 6:49:29 PM3/19/17
to node...@googlegroups.com
Thanks Julian,

Whatever I set the path to the private key I get the same keypath error. If I run javascript file with the same keys it works without any error.
The problem does exist when I run node-red.
Could you give an example how to set the path?

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/RJDesFhFzec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/903f3a24-b502-4e3f-a209-c5720e499977%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Nick O'Leary

unread,
Mar 19, 2017, 6:58:48 PM3/19/17
to node...@googlegroups.com

What are you setting the path to? There shouldn't be anything special about it ... Just a path to the cert file.

Nick


To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Graph Sam

unread,
Mar 19, 2017, 8:59:29 PM3/19/17
to node...@googlegroups.com
Hello Nick.... happy to respond on this.

In the settings.js I set the following lines.

    https: {
      key: fs.readFileSync(path.join('/root', '/.node-red', '/certs', 'private.pem.key')),
      cert: fs.readFileSync(path.join('/root', '/.node-red', '/certs', 'certificate.pem.crt')),
      ca: fs.readFileSync(path.join('/root', '/.node-red', '/certs', 'root-CA.crt'))
    },

In the node I set the field for the certs to /root/.node-red/certs

but the results give me always the same error about the keypath.

Welcome to Node-RED
===================

20 Mar 00:46:29 - [info] Node-RED version: v0.16.2
20 Mar 00:46:29 - [info] Node.js  version: v6.2.1
20 Mar 00:46:29 - [info] Linux 4.4.41-36.55.amzn1.x86_64 x64 LE
20 Mar 00:46:29 - [info] Loading palette nodes
20 Mar 00:46:30 - [info] Dashboard version 2.3.5 started at /ui
20 Mar 00:46:30 - [warn] ------------------------------------------------------
20 Mar 00:46:30 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
20 Mar 00:46:30 - [warn] [mqtt] Error: Cannot find module 'buffer-shims'
20 Mar 00:46:30 - [warn] [feedparse] Error: Cannot find module 'util-deprecate'
20 Mar 00:46:30 - [warn] ------------------------------------------------------
20 Mar 00:46:30 - [info] Settings file  : /root/.node-red/settings.js
20 Mar 00:46:30 - [info] User directory : /root/.node-red
20 Mar 00:46:30 - [info] Flows file     : /root/.node-red/flows_ip-172-31-22-220.json
20 Mar 00:46:30 - [info] Server now running at http://127.0.0.1:1880/
20 Mar 00:46:30 - [info] Starting flows
20 Mar 00:46:30 - [info] [aws-iot-device:MQTT-AWS] Attempt to connect to broker with 00-04-A3-0B-00-1A-06-58 from: /root/.node-red/certs
20 Mar 00:46:30 - [error] [aws-mqtt in:23215990.b98496] Error: Invalid "keyPath" option supplied.
20 Mar 00:46:30 - [info] Started flows


The error in the startup of Node-RED prevents me from accessing the flow editor from the browser. Hence, I am forced to comment out the lines in the settings.js file for the key path to start node-red normally but the error I can get it when the path /root/.node-red/certs is triggered from the flow to give me again the same error.

3/20/2017, 12:47:43 AMnode: 8b125318.5079emsg : error
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/RJDesFhFzec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Julian Knight

unread,
Mar 20, 2017, 4:51:55 AM3/20/17
to Node-RED
2 things. Firstly you don't need the "/" on any of the path elements.

Secondly, you shouldn't be running as root. That throws loads of other things out of whack & opens your machine's security quite badly.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/RJDesFhFzec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Nick O'Leary

unread,
Mar 20, 2017, 6:31:12 AM3/20/17
to Node-RED Mailing List
Ah, so this error is coming from the aws-mqtt node - you hadn't mentioned that anywhere.

I haven't used it myself so cannot help directly and I don't know why that node is complaining about your configuration.

It's readme does explain a bit about what is expected to exist in that certs directory: http://flows.nodered.org/node/node-red-contrib-aws-iot-hub
I would start by double checking that.

If you continue to have an issue, I suggest you raise an issue on that node's github repo to get the author's help.

Nick


To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Graph Sam

unread,
Mar 20, 2017, 11:35:11 AM3/20/17
to node...@googlegroups.com
Thanks a lot Nick for your answer.

I have this working on the end-device to access keys from the path suggested by the node library creator but this doesn't work for me on the application server because of the keyPath error message.
I tried to create a javascript file to access the keys and it works without errors so the only problem here is from within Node-RED.

Please if you can get this working in your environment so just let me know.

/Samy

To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Julian Knight

unread,
Mar 20, 2017, 12:39:45 PM3/20/17
to Node-RED
I replied to your PM - I'm not sure you have the right settings.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/RJDesFhFzec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Graph Sam

unread,
Mar 20, 2017, 12:47:47 PM3/20/17
to node...@googlegroups.com
Thanks Julian for your hints!

The keys are signed and I can access them from javascript file without any error message. The problem is that I can't access them from within Node-RED. Do you have any suggestion about any of my configurations?

To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Nick O'Leary

unread,
Mar 20, 2017, 12:53:04 PM3/20/17
to Node-RED Mailing List
Hi,

the problem is something specific to the AWS node. Have you contacted its author?

NIck

To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.

To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Graph Sam

unread,
Mar 20, 2017, 12:59:06 PM3/20/17
to node...@googlegroups.com
Yes I have sent him a message to look at it. I will inform you if there's any information.

Thanks

Graph Sam

unread,
Mar 21, 2017, 7:00:37 AM3/21/17
to node...@googlegroups.com
Hi Nick,

Which mqtt node version I have to install so that I can get the fields shown in the attached files?

I am asking because I can't find the security/keys fields in the mqtt node, I have downloaded three different mqtt nodes but none of them has the fields to specify the security keys.

node-red-contrib-mqttssl
node-red-contrib-mqtt-env
node-red-contrib-mqtt-dynamic

In addition, Node-RED version 0.16.2 has no mqtt node at all while the mqtt node is included in Node-RED
in previous versions like 0.10.x  

/Samy
certificate-mqtt.jpg

Nick O'Leary

unread,
Mar 21, 2017, 8:15:38 AM3/21/17
to Node-RED Mailing List
The MQTT nodes are part of the core install of node-red. If they are missing from your palette that suggests you are using node-red 0.16 with node.js 0.10.

Node.js 0.10 is no longer supported - one of the symptoms of using it is the MQTT nodes no longer work as they depend on a newer version of node.js.

Once you have updated your node.js version, you'll find the MQTT nodes are there, and in their broker configuration you can enable a TLS connection where you provide the cert paths.

Nick

Graph Sam

unread,
Mar 21, 2017, 8:23:16 AM3/21/17
to node...@googlegroups.com
Do you know on Linux how to specify which node.js version from command line? ... does it work if npm downloads the latest version of node.js?

Graph Sam

unread,
Mar 21, 2017, 8:30:37 AM3/21/17
to node...@googlegroups.com
Hi Nick,

It's already installed node.js v6.2.1 and this should work, am I right?

/Samy

Nick O'Leary

unread,
Mar 21, 2017, 9:02:23 AM3/21/17
to Node-RED Mailing List
When Node-RED starts up it logs what version of node.js it is using, along with any errors associated with the nodes it tried to load.

Can you share that start-up log (up to the point where it says 'starting flows')?

Nick

Graph Sam

unread,
Mar 21, 2017, 9:43:42 AM3/21/17
to node...@googlegroups.com
Here it's the print at start of Node-RED.


Welcome to Node-RED
===================

21 Mar 09:33:07 - [info] Node-RED version: v0.16.2
21 Mar 09:33:07 - [info] Node.js  version: v6.2.1
21 Mar 09:33:07 - [info] Linux 4.4.41-36.55.amzn1.x86_64 x64 LE
21 Mar 09:33:07 - [info] Loading palette nodes
21 Mar 09:33:07 - [info] Dashboard version 2.3.5 started at /ui
21 Mar 09:33:08 - [warn] ------------------------------------------------------
21 Mar 09:33:08 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
21 Mar 09:33:08 - [warn] [mqtt] Error: Cannot find module 'buffer-shims'
21 Mar 09:33:08 - [warn] [feedparse] Error: Cannot find module 'util-deprecate'
21 Mar 09:33:08 - [warn] ------------------------------------------------------
21 Mar 09:33:08 - [info] Settings file  : /root/.node-red/settings.js
21 Mar 09:33:08 - [info] User directory : /root/.node-red
21 Mar 09:33:08 - [info] Flows file     : /root/.node-red/flows_ip-112-11-09-200.json
21 Mar 09:33:08 - [info] Server now running at http://127.0.0.1:1880/
21 Mar 09:33:08 - [info] Starting flows
21 Mar 09:33:08 - [info] [aws-iot-device:MQTT-AWS] Attempt to connect to broker with 00-01-A2-0B-00-A1-02-33 from: /root/.awscerts/
21 Mar 09:33:08 - [error] [aws-mqtt in:23215990.b98496] Error: Invalid "keyPath" option supplied.

Nick O'Leary

unread,
Mar 21, 2017, 9:58:03 AM3/21/17
to Node-RED Mailing List
That suggests to me you've updated the version of node.js you are using after you installed node-red.

How did you install node-red?

Whilst not on topic, also worth saying that you should avoid running as root if you don't need to... but lets tackle one thing at a time.

Nick


Graph Sam

unread,
Mar 21, 2017, 10:38:15 AM3/21/17
to node...@googlegroups.com

Nick O'Leary

unread,
Mar 21, 2017, 10:45:12 AM3/21/17
to Node-RED Mailing List
So if you rerun the install command:

   sudo npm install -g --unsafe-perm node-red

it will rebuild the binary modules that need to be updated for node 6


Nick

Graph Sam

unread,
Mar 21, 2017, 11:22:26 AM3/21/17
to node...@googlegroups.com
Nick,

It doesn't work with sudo since it gives me errors and stops.

npm ERR! Linux 4.4.41-36.55.amzn1.x86_64
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "--unsafe-perm" "node-red"
npm ERR! node v0.6.8
npm ERR! npm  v2.15.11

npm ERR! Object #<Object> has no method 'exists'
npm ERR!
npm ERR! If you need help, you may report this error at:


I tried then the same command without sudo and it worked and now I can find the original mqtt node and used it in the flow.

The sudo problem looks at different place to start npm namely from /usr/local/bin/npm ... I think I have to remove npm from that path. 
ooooh I remember now that I did a node-red installation previously using nvm, I don't know if that installation though it's stopped might be causing problems to me. If you know how to remove that nvm installation just let me know ... the path for that in /root/.nvm/versions/node/v6.2.1/bin/node

Please let me know if I need more configurations to get the environment set correctly.


Thanks a lot for your help!


Nick O'Leary

unread,
Mar 21, 2017, 11:23:59 AM3/21/17
to Node-RED Mailing List
I suggest you read the nvm docs for how to tidy it up. Our docs don't cover nvm so I can't really help on that specifically.

Glad to hear you've got the mqtt nodes back.

Nick

Dave C-J

unread,
Mar 21, 2017, 11:36:45 AM3/21/17
to node...@googlegroups.com
Yes your underlying node installation seems to be 
Inline images 1
which is well out of support... so yeah... sort out nvm .

Graph Sam

unread,
Mar 21, 2017, 12:19:38 PM3/21/17
to node...@googlegroups.com

Thanks Dave!
Yes I understand it and I will do clean up the nvm installations.
However, after running the following commands 

npm -v

it displays 4.4.2

and 

node -v

it displays  

v6.2.1

Hence, the stopped installation using nvm works fine unless I use sudo then it would read from nvm.
 

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/RJDesFhFzec/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.

Graph Sam

unread,
Mar 21, 2017, 6:14:14 PM3/21/17
to node...@googlegroups.com
Nick, Julian and Dave,

Thanks a lot for your suggestions!.... Now it works as expected.
I have now Node-RED installed on the end-device and another instance is installed on the application server. They communicate with each other using the native MQTT node. The messages are passed in both directions.

Node-RED version on end-device: v0.10.x
Node-RED version on the application server: v0.16.2


Reply all
Reply to author
Forward
0 new messages