Azure / iotedge

The IoT Edge OSS project
MIT License
1.45k stars 458 forks source link

Change the default protocol to other options on SimulatedTemperatureSensor #7329

Closed ernestoguimaraes closed 2 weeks ago

ernestoguimaraes commented 1 month ago

Expected Behavior

Some networks does not allow Amqp_Tcp_Only , defined on line 77 of Program.cs. It should be able to change this value from Parameters or Environment Variables.

Current Behavior

During the Module provisioning, Im adding the Environment Variable ClientTransportType=Mqtt_WebSocket_Only but at the end, the solution is trying to use the Amqp_Tcp_Only always.

Steps to Reproduce

Provide a detailed set of steps to reproduce the bug.

  1. Set a new module and select from Marketplace the SimulatedTemperatureSensor
  2. Add a Environment Variable called ClientTransportType and value Mqtt_WebSocket_Only
  3. Once created, check the sudo iotedge logs SimulatedTemperatureSensor

Context (Environment)

  1. AMQP should be blocked on network where edge is running and communicating with IotHub
vipeller commented 1 month ago

Hi, those are the right steps and the code is supposed to pick the variable up. Can you 'docker inspect' to container, and copy the environment variable section here with the relevant part?

And just to be sure: what you see is that the module logs under "Trying to initialize module client using transport type" that it uses amqp? (vs it reports the configured mqtt websocket but then it uses amqp)

bishal41 commented 3 weeks ago

@ernestoguimaraes were you able to take the suggested steps by @vipeller? Is the issue resolved?

ernestoguimaraes commented 2 weeks ago

Hello. I found another solution. Which is kind of different. Looking on the article to enable proxy:https://learn.microsoft.com/en-us/azure/iot-edge/how-to-configure-proxy-support?view=iotedge-1.5 there is one step where the config.toml should be changed.

[agent.env]

"RuntimeLogLevel" = "debug"

"UpstreamProtocol" = "AmqpWs"

"https_proxy" = "

on UpstreamProtocol I use the value Mqtt_WebSocket_Only and not MqttWs and it worked.

Thank you

bishal41 commented 2 weeks ago

thanks @ernestoguimaraes, closing the issue.