Azure / azure-iot-hub-node

Azure IoT Hub Data Plane Node SDK
MIT License
1 stars 7 forks source link

Started receiving 'error trying to connect' issue creating new device in IoTRegistry #41

Open mcgear opened 3 months ago

mcgear commented 3 months ago

Hey, we had some code that was previously working against our IoT Hubs that had minTlsVersion set to 1.2, but we had to remove that in order to support more regions with our product. After removing the minTlsVersion setting, now the IoTRegistry client isn't working.

here is our simple code that previously worked:

    const iotHubConnStr =
      `{primaryConnStrFromAzurePortal}`;

    const iotRegistry = IoTRegistry.fromConnectionString(iotHubConnStr);

    await iotRegistry.get('sim000001');

And the error that we are now getting is:

error: TypeError: error sending request for url (https://{iot-hub-name}.azure-devices.net/devices/sim000001?api-version=2021-04-12): error trying to connect: An existing connection was forcibly closed by the remote host. (os error 10054)

Thanks for any help on what we might be missing!

mcgear commented 3 months ago

I should also note that this is running in Deno not node.

mcgear commented 3 months ago

I was able to confirm that by switching back to tls 1.2, the code provided begins working again. How can we use the IoTRegistry client with minTlsVersion NOT set to 1.2? Thanks for the help

mcgear commented 1 month ago

I setup a test that replicates this issue, hoping we can get a bit of help on it.

The integration branch of this repository: https://github.com/fathym-deno/iot-hub-device-create-tests

Specifically this test: https://github.com/fathym-deno/iot-hub-device-create-tests/blob/integration/tests/temp/device-create.ts

You will need to create a '.env' file at the root of the project with: IOT_HUB_CONN_STR=xxx

Where 'xxx' is the IoT Hub Connection String

You would need the latest Deno installed, then once you have our repo cloned you can run the command: deno task test

And you should get the error from above.