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

Send an event to Azure Event Hub authenticating via Service Principal throws "azure.eventhub.exceptions.EventHubError: get_token must be a coroutine function" error #25870

Closed
rbuenoc opened this issue Aug 25, 2022 · 0 comments
Labels
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 needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@rbuenoc
Copy link

rbuenoc commented Aug 25, 2022

  • Package Name: azure-eventhub
  • Package Version: 5.10.1
  • Operating System: Windows
  • Python Version: 3.9.4

Describe the bug
Trying to send an event to Azure Event Hub authenticating via Service Principal throws "azure.eventhub.exceptions.EventHubError: get_token must be a coroutine function" error

To Reproduce
Steps to reproduce the behavior:

  1. Install requirements
azure-identity==1.10.0
azure-eventhub==5.10.1
  1. Run the following code, replacing the corresponding variables.
import asyncio
from azure.identity import ClientSecretCredential
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub import EventData

async def run():
    credentials = ClientSecretCredential('<tenant-id>', '<application-id>', '<secret-key>')
    producer = EventHubProducerClient('<fully-qualified-namespace>', '<eventhub-name>', credentials)
    async with producer:
        event_data_batch = await producer.create_batch()
        event_data_batch.add(EventData('First event '))
        event_data_batch.add(EventData('Second event'))
        event_data_batch.add(EventData('Third event'))

        await producer.send_batch(event_data_batch)

loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Expected behavior
Code running successfully and message sent to Azure Event Hub without any error.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 25, 2022
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 25, 2022
@azure-sdk azure-sdk added Client This issue points to a problem in the data-plane of the library. Event Hubs needs-team-triage Workflow: This issue needs the team to triage. labels Aug 25, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Aug 25, 2022
@rbuenoc rbuenoc closed this as completed Aug 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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 needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants