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

Cannot receive C2D messages when connect using DeviceClient.createFromSecurityProvider #528

Closed
larrype opened this issue May 23, 2019 · 4 comments
Assignees
Labels
bug fix checked in Fix checked into main or preview, but not yet released.

Comments

@larrype
Copy link

larrype commented May 23, 2019

  • OS and version used:
    Observed issue on Windows 10 and Android API 29
  • Java runtime used:
    JDK 1.8 for Windows and Android
  • SDK version used:
    iot-device-client 1.17.2
    security-provider 1.3.0
    x509-provider 1.1.3
    provisioning-device-client 1.7.0
    iot-deps 0.8.3

Description of the issue:

When creating the DeviceClient using DeviceClient.createFromSecurityProvider we are unable to receive C2D messages (sent either via azure portal or using service sdk). When created using the connection string and certificate files or strings [ "new DeviceClient( ... )" ] then c2d messages work fine. Further, using the connection string method one time will cause c2d messages to work even when connecting using createFromSecurityProvider.

For production our device has high security requirements and we use a custom security provider and therefore we require the use of createFromSecurityProvider.

Code sample exhibiting the issue:

If you only ever connect to iot hub like this, cannot receive c2d message...
deviceClient = DeviceClient.createFromSecurityProvider(iotHubUri, deviceId, securityProviderX509, IotHubClientProtocol.MQTT);

If you connect like this then c2d messages can be received AND after connecting like this once it seems that subsequent connections using createFromSecurityProvider work as well.
deviceClient = new DeviceClient(connStringX509, IotHubClientProtocol.MQTT, this.getCertPath(), true, this.getKeyPath(), true);

Console log of the issue:

Need Support?

  • Have a feature request for SDKs? Please post it on User Voice to help us prioritize.
  • Have a technical question? Ask on Stack Overflow with tag “azure-iot-hub”
  • Need Support? Every customer with an active Azure subscription has access to support with guaranteed response time. Consider submitting a ticket and get assistance from Microsoft support team
  • Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub (C, Java, .NET, Node.js, Python).
@timtay-microsoft
Copy link
Member

I've taken a look into this issue, and it is a bug on our side. Currently, only MQTT/MQTT_WS have this issue though. If you would switch to AMQPS/AMQPS_WS or HTTPS you would be good to receive messages.

I'm working to fix the issue with MQTT.

@timtay-microsoft
Copy link
Member

We have the fix for this issue checked in now, and are planning to do a release tomorrow (5/31)

@timtay-microsoft
Copy link
Member

The fix for this issue was released, so I'm closing this issue. Feel free to file a new issue if you still see this problem.

@az-iot-builder-01
Copy link
Collaborator

@larrype, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

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.
Projects
None yet
Development

No branches or pull requests

3 participants