absmach / magistrala

Industrial IoT Messaging and Device Management Platform

Home Page:https://www.abstractmachines.fr/magistrala.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Unable to enable thing using bootstrap

nyagamunene opened this issue · comments

What were you trying to achieve?

I was trying to connect a thing to the channels by using curl request to the things service.

What are the expected results?

The expected result is a successful response indicating that the thing has been connected to the channel.

What are the received results?

This was the received results. When setting the state to 1 this is the result.
image
And this is the logs from the bootstrap service.
image
And this is the logs from the things service.
image

Steps To Reproduce

  1. Run Magistrala using command make run
  2. Run Bootstrap service using command make run_addons bootstrap
  3. Created new thing and channel.
  4. Create bootstrap configuration of the thing and channel
  5. Connect the thing to the channels using the following request:
    curl -s -S -i -X PUT -H "Authorization: Bearer <user_token>" -H "Content-Type: application/json" http://localhost:9013/things/state/<thing_id> -d '{"state": 1}'

In what environment did you encounter the issue?

Docker

Additional information you deem important

This issue is preventing the thing from being connected to the channels, which is a critical functionality.For more details, Please refer below bootstrap doc
https://docs.magistrala.abstractmachines.fr/bootstrap/

image
If the connection between the 'thing_id' and 'channel_id' was established through the User Interface (UI), then the disconnection should also be performed through the UI. Similarly, if the connection was established using the curl command in the terminal, the disconnection should also be executed using a curl command in the terminal.

As it stands, there is no interchangeability between the two methods. In other words, a connection made through the UI cannot be disconnected using a curl command in the terminal, and vice versa. Each method of connection requires its corresponding method of disconnection.

Actually, the two methods are interchangeable and the error is as a result of poor error handling in bootstrap when you try to connect a thing that is already connected to a channel. A more intuitive output would be one that let's the user know the connection already exists or simply return an OK

image