question

jjyuu-6497 avatar image
0 Votes"
jjyuu-6497 asked jjyuu-6497 edited

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

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-learningazure-databricksazure-event-hubs
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@jjyuu-6497 I do not have much experience with databricks or eventhub scenarios with Azure ML but looking at above snippet are you passing the correct variable for the connection string in the method EventHubProducerClient.from_connection_string()?

I see you defined the variable as:

 conn_sting = "Endpoint=***"

But you are using the following variable conn_string in below call:

 producer = EventHubProducerClient.from_connection_string(conn_str=conn_string)





0 Votes 0 ·

@romungi-MSFT
Hi @romungi-MSFT,,
I changed the config_string like thst as thats the secret value. Im just wondering if MSFT has expert of eventhub an databricks who can help resolve this issue.
I even tried to send basic json to reventhub but it failed..

0 Votes 0 ·

0 Answers