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 Report] TwinClient replace method does not work with AzureSasCredential #1657

Closed
ranjith-t opened this issue Jan 16, 2023 · 3 comments
Closed
Assignees
Labels
bug fix checked in Fix checked into main or preview, but not yet released. IoTSDK

Comments

@ranjith-t
Copy link

ranjith-t commented Jan 16, 2023

Context

  • OS Used: Ubuntu 20.04.2 LTS
  • Java runtime used: openjdk version "1.8.0_342"
  • SDK version used: 2.1.3

Description of the issue

When device twin replace was requested through TwinClient class, it does not update the twin when AzureSasCredential is used for connection. At the IotHub, neither update of device twin nor there is any exception from TwinClient.

Code sample exhibiting the issue

TwinClient method replace() does not work when the TwinClient uses AzureSasCredential. It looks like the reason being that the iotHubConnectionString is not able to get proper URL for http request. All other classes tries to use 'hostname'(which is set), but in this particular case it tries to use deviceId to derive the url while the iotHubConnectionString is not initialized.

URL url; if (twin.getModuleId() == null || twin.getModuleId().length() == 0) { url = this.iotHubConnectionString.getUrlTwin(twin.getDeviceId()); } else { url = this.iotHubConnectionString.getUrlModuleTwin(twin.getDeviceId(), twin.getModuleId()); }

Console log of the issue

@ranjith-t ranjith-t added the bug label Jan 16, 2023
@ranjith-t ranjith-t changed the title [Bug Report] TwinClient replace mthod does not work with AzureSasCredential [Bug Report] TwinClient replace method does not work with AzureSasCredential Jan 16, 2023
@brycewang-microsoft brycewang-microsoft self-assigned this Jan 17, 2023
@brycewang-microsoft
Copy link
Collaborator

Hi @ranjith-t, thanks for bringing this to our attention! The fix has been merged in and I will update here again once we release a newer version including it.

@brycewang-microsoft brycewang-microsoft added the fix checked in Fix checked into main or preview, but not yet released. label Jan 19, 2023
@brycewang-microsoft
Copy link
Collaborator

The hub service client package 2.1.6 has been released with the fix included, so I am closing this thread.

@ranjith-t
Copy link
Author

Just confirming that this issue has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix checked in Fix checked into main or preview, but not yet released. IoTSDK
Projects
None yet
Development

No branches or pull requests

2 participants