Token authentication failed: 'utf-8' codec can't decode byte 0xe4 in position 0: invalid continuation byte

jj.yuu 26 Reputation points
2021-12-22T18:48:18.043+00:00

I'm trying to send the json data from azure ml to eventhub using codes below

import json
d = result.to_dict(orient='records')
data = json.dumps(d,ensure_ascii=False)

import asyncio
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub import EventData
import time
conn_sting = "Endpoint=***"
async def run():
producer = EventHubProducerClient.from_connection_string(conn_str=conn_string)
async with producer:

event_data_batch = await producer.create_batch(partition_id='0')
event_data_batch.add(EventData(data))


await producer.send_batch(event_data_batch)

nest_asyncio.apply()
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
print("sent to eventhub")

and getting follwing error..

Token authentication failed: 'utf-8' codec can't decode byte 0xe4 in
position 0: invalid continuation byte
Token authentication failed: 'utf-8' codec can't decode byte 0xe4 in
position 0: invalid continuation byte

anyone could help debug the error? thanks

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,332 questions
Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
719 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,514 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.