after consuming some messages from azure servicebus queue, python sdk for azure-servicebus is failing with below error
socket.send() raised exception.
Unexpected error occurred (TypeError('Received message 257:None is not bytes')). Handler shutting down.
Traceback (most recent call last):
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/aio/_base_handler_async.py", line 269, in _do_retryable_operation
return await operation(**kwargs)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/aio/_servicebus_receiver_async.py", line 410, in _receive
receiving = await amqp_receive_client.do_work_async()
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_client_async.py", line 357, in do_work_async
return await self._client_run_async(**kwargs)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_client_async.py", line 753, in _client_run_async
await self._connection.listen(wait=self._socket_timeout, **kwargs)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_connection_async.py", line 798, in listen
if await self._read_frame(wait=wait, **kwargs):
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_connection_async.py", line 268, in _read_frame
new_frame = await self._transport.receive_frame(timeout=timeout, **kwargs)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_transport_async.py", line 76, in receive_frame
header, channel, payload = await asyncio.wait_for(
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
return fut.result()
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/asyncio/futures.py", line 201, in result
raise self._exception.with_traceback(self._exception_tb)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/asyncio/tasks.py", line 232, in __step
result = coro.send(None)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_transport_async.py", line 133, in read
await self._read(payload_size, buffer=payload)
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/azure/servicebus/_pyamqp/aio/_transport_async.py", line 532, in _read
data = await self.sock.receive_bytes()
File "/home/trusted-service-user/cluster-env/clonedenv/lib/python3.10/site-packages/aiohttp/client_ws.py", line 281, in receive_bytes
raise TypeError(f"Received message {msg.type}:{msg.data!r} is not bytes")
TypeError: Received message 257:None is not bytes
exception:Handler failed: Received message 257:None is not bytes.
below is the code using to fetch messages from queue
from azure.servicebus import TransportType
from azure.servicebus.aio import ServiceBusClient
servicebus_client = ServiceBusClient.from_connection_string(connection_string,
transport_type=TransportType.AmqpOverWebsocket,
max_lock_duration=180, logging_enable=True)
async with servicebus_client:
receiver = servicebus_client.get_queue_receiver(queue_name)
async with receiver:
messages = await receiver.receive_messages(max_message_count=5000, max_wait_time=60)
python version 3.10 and azure-servicebus version 7.11.2