[英]AWS IoT - how to specify the certificate path (Swagger + NodeJS)
I am working with AWS IoT, and try to publish a topic on AWS IoT. 我正在使用AWS IoT,并尝试发布有关AWS IoT的主题。
What I have done: 我做了什么:
In file js, update code as below 在文件js中,更新代码如下
var device = awsIot.device({ keyPath: 'cert/xxxxxx-private.pem.key', certPath: 'cert/xxxxxx-certificate.pem.crt', caPath: 'cert/rootCA.pem', clientId: 'TestIoT', host: 'xxxxxxxx.amazonaws.com' }); var device = awsIot.device({keyPath:'cert / xxxxxx-private.pem.key',certPath:'cert / xxxxxx-certificate.pem.crt',caPath:'cert / rootCA.pem',clientId:'TestIoT ”,主机:“ xxxxxxxx.amazonaws.com”});
What error I received : 我收到什么错误:
Invalid "keyPath" option supplied. 提供了无效的“ keyPath”选项。 at module.exports (/var/app/current/node_modules/aws-iot-device-sdk/common/lib/tls-reader.js:92:13) at new DeviceClient (/var/app/current/node_modules/aws-iot-device-sdk/device/index.js:416:7) at Object.DeviceClient [as device] (/var/app/current/node_modules/aws-iot-device-sdk/device/index.js:201:14) 在module.exports(/var/app/current/node_modules/aws-iot-device-sdk/common/lib/tls-reader.js:92:13)在新DeviceClient(/ var / app / current / node_modules / aws) -iot-device-sdk / device / index.js:416:7)位于Object.DeviceClient [作为设备](/var/app/current/node_modules/aws-iot-device-sdk/device/index.js:201 :14)
As I understand, the path is not specified correctly. 据我了解,该路径未正确指定。 Please give me some advices how to specify the path correctly. 请给我一些建议,如何正确指定路径。
Try relative paths: 尝试相对路径:
'./cert/xxxxxx-private.pem.key'
It is the same path but adding "./" at the start. 这是相同的路径,但在开头添加“ ./”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.