Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Azure IoT Hub <> Portal sync doesn't work as expected #2833

Open
Metal-Mighty opened this issue Jan 29, 2024 · 4 comments
Open

Bug: Azure IoT Hub <> Portal sync doesn't work as expected #2833

Metal-Mighty opened this issue Jan 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Metal-Mighty
Copy link
Contributor

Expected Behavior

Since the introduction of the database cache for the portal, I expect it to stay up to date with what's actually in the IoT Hub on Azure (models, devices, etc).

Current Behavior

The portal doesn't fully synchronize with IoT Hub. It adds elements from IoT Hub to its db, but if elements are deleted directly from the IoT Hub without using the portal, elements stay in the DB and sometimes can't even be removed from the portal. Same goes if the IoT Hub is deleted and created again: The portal still has the old data.
It can also lead to errors in automated deployment tasks: We use the API to check for existing models and we create or update them depending on the result, but since it doesn't return the actual Azure data, it doesn't always properly create or update elements. This is also especially problematic on elements with unique IDs, connection keys, etc. (e.g., Edge Devices credentials).

Steps to Reproduce

  1. Add something (e.g. device model) to the portal
  2. Remove the element from Azure directly
  3. The element is still in the portal

Context (Environment)

Portal version: 4.13.2.170
LoRaWAN Stack version: N/A

Logs

Additional Information

@Metal-Mighty Metal-Mighty added the bug Something isn't working label Jan 29, 2024
@github-project-automation github-project-automation bot moved this to 📝 Todo in IoT Hub Portal Jan 29, 2024
@kbeaugrand
Copy link
Member

@Metal-Mighty the portal has a synchronization scheduler. I could take some minutes to reflect Azure IoT Hub changes to the portal directly.

I encourage you to not change devices directly on IoT Hub while using the portal to limit the apparition to this issue.

By the way, the refresh timeout is by default set to 5 minute. You can adapt it in your settings to reduce it in case it is necessary:
(See: https://cgi-fr.github.io/IoT-Hub-Portal/stable/dev-guide/#application-settings:~:text=Job__SyncDatabaseJobRefreshIntervalInMinutes for more details).

Ar you able to reproduce it after the sync timeout?

@Metal-Mighty
Copy link
Contributor Author

Hi @kbeaugrand !
I can confirm it's still an issue after a sync timeout since I realized this afternoon that device models (in IoT Hub > Configurations + Deployments) were missing, even though they were in the portal since Friday.
Sadly this comes after having to recreate the IoT Hub because it wasn't properly created on Azure, and it was the only thing to do according to our contact at Microsoft, so not something we could have done in the Portal ;)

What I could have done would be to delete everything from the Portal prior to deleting the IoT Hub, but I didn't think about it back then!

@Metal-Mighty
Copy link
Contributor Author

We're having the same issue today in another use case: We have and IoT Hub, and an Azure-hosted IoT Portal connected to it and a number of devices (and edge devices) + their associated models declared.
We started a Portal locally on a development machine with a local db (= not the one used by the portal on Azure), but connected to the same Azure IoT Hub as our Azure Portal.

=> The local Portal didn't sync the data from IoT Hub into the development portal's DB. Only the Dashboard has correct information (and we did wait much more than 5 minutes 😉)
The dev instance is started using the code in the main branch.

image
image

@kbeaugrand
Copy link
Member

I In this case, I assume that this problem occurs because device models are not created in the development environment.

Could you check that all models are also created in the development environment because they should be present to be able to synchronize their devices.

Note that since models are not a supported feature on Azure IoT hub, they could not be synchronized anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📝 Todo
Development

No branches or pull requests

2 participants