节点红色 - 无法连接:getAddrinfo enotfound xxx-device-hub.azure-devices.net&quot&quot&quot

发布于 2025-01-28 09:33:20 字数 2167 浏览 4 评论 0原文

我是Node-Red的新手,我正在尝试使用Node-Red创建一个简单的将数据发送到我的Azure Iot Hub的流程。但是,每当我发送数据时,获取以下错误“无法连接:getAddrinfo enotfound xxx-device-hub.azure-devices.net”。我尝试使用不同的所有权限使用不同的共享访问键,但仍然相同。我正在通过代理网络工作。请提供帮助,因为我无法工作,因此

您可以导入我的节点红色流:

[
    {
        "id": "6f18f82cf1fb4430",
        "type": "tab",
        "label": "Flow 5",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "191eb7ca.b71a8",
        "type": "azureiothub",
        "z": "6f18f82cf1fb4430",
        "name": "Azure IoT Hub",
        "protocol": "mqtt",
        "x": 640,
        "y": 340,
        "wires": [
            [
                "39c7854c.56d18a"
            ]
        ]
    },
    {
        "id": "39c7854c.56d18a",
        "type": "debug",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 870,
        "y": 340,
        "wires": []
    },
    {
        "id": "b73c20238ff65f0f",
        "type": "inject",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 340,
        "wires": [
            [
                "d9b5bad69079e9ea"
            ]
        ]
    },
    {
        "id": "d9b5bad69079e9ea",
        "type": "function",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "func": "msg.payload ={\"deviceID\":\"DC_Tower_Clock\",\"SAK\":\"<Shared-access-key>\",\"Protocol\":\"mqtt\",\"Data\":{\"DC_sensor1values\":[0],\"DC_sensor1timestamp\":[1651774945]}}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 340,
        "wires": [
            [
                "191eb7ca.b71a8"
            ]
        ]
    }
]

I'm new to node-red and I'm trying to create a simple flow of sending data to my Azure IoT hub using node-red. But whenever I send the data the get the following error "Could not connect: getaddrinfo ENOTFOUND xxx-device-hub.azure-devices.net". I tried with different Shared access keys with all permission but still the same. I am working over a proxy network. Please help as I'm not able to work because of this

you can import my node-red flow :

[
    {
        "id": "6f18f82cf1fb4430",
        "type": "tab",
        "label": "Flow 5",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "191eb7ca.b71a8",
        "type": "azureiothub",
        "z": "6f18f82cf1fb4430",
        "name": "Azure IoT Hub",
        "protocol": "mqtt",
        "x": 640,
        "y": 340,
        "wires": [
            [
                "39c7854c.56d18a"
            ]
        ]
    },
    {
        "id": "39c7854c.56d18a",
        "type": "debug",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 870,
        "y": 340,
        "wires": []
    },
    {
        "id": "b73c20238ff65f0f",
        "type": "inject",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 160,
        "y": 340,
        "wires": [
            [
                "d9b5bad69079e9ea"
            ]
        ]
    },
    {
        "id": "d9b5bad69079e9ea",
        "type": "function",
        "z": "6f18f82cf1fb4430",
        "name": "",
        "func": "msg.payload ={\"deviceID\":\"DC_Tower_Clock\",\"SAK\":\"<Shared-access-key>\",\"Protocol\":\"mqtt\",\"Data\":{\"DC_sensor1values\":[0],\"DC_sensor1timestamp\":[1651774945]}}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 340,
        "wires": [
            [
                "191eb7ca.b71a8"
            ]
        ]
    }
]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

数理化全能战士 2025-02-04 09:33:20

问题不是访问键,而是与您的经纪人的主机名一起使用。

错误enotfound表示您正在运行的系统上的操作系统无法解析xxx-device-hub.azure-devices.net到IP地址。

确保您输入了合适的主机名,它们没有错别字。

您可以首先尝试通过ping ping ping the node-red ping进行测试。

The problem is not with the access keys, it's with the hostname for your broker.

Error ENOTFOUND means that the OS on the system you are running can not resolve xxx-device-hub.azure-devices.net to an IP address.

Make sure you have entered the right hostname and their are no typos.

You can test by trying to ping the address outside Node-RED first.

甜是你 2025-02-04 09:33:20

我的流程有两个问题:

  1. 在有效载荷内,我没有正确的配置(deviceId而不是deviceid and sak而不是键),
  2. 当它实际上是http时,我作为MQTT的协议
  3. ,主要问题实际上是公司代理,因为我能够使用我的个人笔记本电脑发送消息,但是与我无法使用的工作笔记本电脑相同。

“

There were couple of issues with my flow:

  1. inside the payload I did not have the configuration right (deviceID instead of deviceId and SAK instead of key)
  2. I had my protocol as MQTT when it was actually HTTP
  3. And the main problem was actually the company proxy, as I'm able to send the messages using my personal Laptop but with the same flow with my Work Laptop I'm not able to.

Screen Shot For Reference

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文