Skip to content

Fix sample by truncating iot hub name to 25 chars#18521

Closed
mtin wants to merge 1 commit intoAzure:masterfrom
mtin:patch-1
Closed

Fix sample by truncating iot hub name to 25 chars#18521
mtin wants to merge 1 commit intoAzure:masterfrom
mtin:patch-1

Conversation

@mtin
Copy link
Copy Markdown

@mtin mtin commented May 5, 2021

I had trouble running the event hub sample for retrieving messages from the built-in endpoint of an IoT hub. An earlier version of the sdk had integrated support to create a receiver from an iot hub connection string (EventHubClient.from_iothub_connection_string()) but it seems like that has been removed?

The sample sdk/eventhub/azure-eventhub/samples/async_samples/iot_hub_connection_string_receive_async.py has methods to generate an event hub connection string from an iot hub connection string - but apparently there is a bug.

The EntityPath part of the connection string has to be truncated to 25 characters, otherwise the sample fails with the following messages:

Authentication Put-Token failed. Retries exhausted.
Authentication Put-Token failed. Retries exhausted.
Authentication Put-Token failed. Retries exhausted.
Authentication Put-Token failed. Retries exhausted.
EventProcessor instance '<snip>' of eventhub '<snip>-test-iothub' consumer group '$Default'. An error occurred while load-balancing and claiming ownership. The exception is AuthenticationError("The messaging entity 'sb://iothub-ns-<snip>.servicebus.windows.net/<snip>-test-iothub' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions.  TrackingId:<snip>, Timestamp:2021-05-05T22:15:29
CBS Token authentication failed.
Status code: 404
Description: The messaging entity 'sb://iothub-ns-<snip>.servicebus.windows.net/<snip>-test-iothub' could not be found. To know more visit https://aka.ms/sbResourceMgrExceptions.  TrackingId:<snip>, Timestamp:2021-05-05T22:15:29 occurred during the load balance process.

I validated the 25 char limit by manually retrieving the event hub compatible connection string from the iot hub page of the azure portal

@ghost ghost added Event Hubs customer-reported Issues that are reported by GitHub users external to the Azure organization. labels May 5, 2021
@ghost
Copy link
Copy Markdown

ghost commented May 5, 2021

Thank you for your contribution mtin! We will review the pull request and get back to you soon.

@rakshith91
Copy link
Copy Markdown
Contributor

/azp run python - eventhub - tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@swathipil
Copy link
Copy Markdown
Member

swathipil commented May 6, 2021

@rakshith91 I believe this sample is in the list of ignored samples, so it should automatically pass the tests. To check that this works, we may need to remove the sample from the ignored samples list and add necessary env vars to the template.

@swathipil
Copy link
Copy Markdown
Member

Hey @mtin, just wanted to give you an update! We're working on testing this sample and testing your fix right now. Thanks for your contribution!

@lmazuel lmazuel added Client This issue points to a problem in the data-plane of the library. blocking-release Blocks release labels May 19, 2021
@lmazuel lmazuel added this to the [2021] June milestone May 19, 2021
@swathipil
Copy link
Copy Markdown
Member

swathipil commented Jun 3, 2021

Hey @mtin! After discussing this with the team, we decided not to merge this PR for the following reasons:

  • The bug that you found was a result of the IoT Hub Service silently truncating the IoT Hub name to 25 characters without any clear documentation. This silent mutation of information passed in by the user should not be happening. Since this is a service issue, we have contacted the IoT team to let them know about the bug, so that they can either fix it or document it.
  • By updating the sample with your commit, we would be silently mutating the information sent in by a user, which is not something we would ever want to do.

However, we really appreciate you calling attention to this bug! We're hoping to have a response from the service team within the next month and have created an issue to track this.

Closing this PR. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocking-release Blocks release Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants