edgexfoundry / edgex-compose

EdgeX Foundry Docker Compose release compose files and tools for building EdgeX compose files
Apache License 2.0
84 stars 119 forks source link

GET, PUT commands do not work for device-mqtt #448

Closed M0hanrajp closed 3 months ago

M0hanrajp commented 3 months ago

🐞 Bug Report

Affected Services

The issue is located in: device-mqtt, while performing get, set operations via edgex UI localhost:4000, 5XX error response is reported for performing get or set, additionally the ping operation from CLI does not return 200 response: ```bash mpunix@LIN-MP22QN1X:~/edgex-foundry/edgex-compose-3.1.1-mqtt$ curl http://localhost:59982/api/v3/ping | json_pp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 90 100 90 0 0 7930 0 --:--:-- --:--:-- --:--:-- 9000 { "apiVersion" : "v3", "serviceName" : "device-mqtt", "timestamp" : "Mon Jul 15 00:35:52 IST 2024" } ``` ### Is this a regression?

Not sure because I have not worked on previous versions.

Description and Minimal Reproduction

πŸ”₯ Exception or Error

device-mqtt logs:

edgex-device-mqtt  | level=INFO ts=2024-07-14T18:51:01.791685687Z app=device-mqtt source=message.go:51 msg="Starting device-mqtt 3.1.1 "
edgex-device-mqtt  | level=INFO ts=2024-07-14T18:51:01.791690179Z app=device-mqtt source=message.go:55 msg="device mqtt started"
edgex-device-mqtt  | level=INFO ts=2024-07-14T18:51:01.791694734Z app=device-mqtt source=message.go:58 msg="Service started in: 97.544869ms"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:55:11.753606883Z app=device-mqtt source=driver.go:111 msg="Handle read commands failed: can not fetch command response: method=get source=randfloat64"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:55:11.753811405Z app=device-mqtt source=restrouter.go:159 X-Correlation-ID=08402bf3-41a3-4eda-8807-8d87492f97bf msg="error reading Regex DeviceResource(s) randfloat64 for MQTT-test-device -> can not fetch command response: method=get source=randfloat64"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:55:31.822734925Z app=device-mqtt source=driver.go:177 msg="Handle write commands failed: can not fetch command response: method=set cmd=randfloat64"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:55:31.824457374Z app=device-mqtt source=restrouter.go:159 X-Correlation-ID=f836236b-c427-4bd5-a2d9-92604c6d0eb9 msg="error writing DeviceResource randfloat64 for MQTT-test-device -> can not fetch command response: method=set cmd=randfloat64"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:56:08.748848372Z app=device-mqtt source=driver.go:111 msg="Handle read commands failed: can not fetch command response: method=get source=ping"
edgex-device-mqtt  | level=ERROR ts=2024-07-14T18:56:08.748967647Z app=device-mqtt source=restrouter.go:159 X-Correlation-ID=241790d0-3b4c-45a3-9654-dabbc79ebf73 msg="error reading Regex DeviceResource(s) ping for MQTT-test-device -> can not fetch command response: method=get source=ping"

🌍 Your Environment

Deployment Environment: Windows 11, WSL2 - Ubuntu 22.04

EdgeX Version: 3.1.1

Anything else relevant? No.


Thanks

jiekechoo commented 3 months ago

Hi @M0hanrajp, these questions are not EdgeX bug, they are common usage issues, maybe you should move to the discussion channel.

It's not a good idea if you want to test EdgeX in the WSL. You need a pure Linux system like Ubuntu version 22 or 23.

cloudxxx8 commented 3 months ago

you have to config the mqtt broker properly, because the default mqtt broker of device-mqtt is not the internal mqtt bus https://github.com/edgexfoundry/device-mqtt-go/blob/35de5baf133cb3849b13998f5bd615ef0c638656/cmd/res/configuration.yaml#L30

Also, you need to set up the MQTT simulator on your own, or nothing will send the response to the MQTT response topic.

M0hanrajp commented 3 months ago

@jiekechoo & @cloudxxx8

Thanks for both of your response.