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

Empty list as a message #25

Open
NazikXY opened this issue May 4, 2024 · 1 comment
Open

Empty list as a message #25

NazikXY opened this issue May 4, 2024 · 1 comment

Comments

@NazikXY
Copy link

NazikXY commented May 4, 2024

Problem with receiving messages from the queue in my environment
I connected to SQS and started listening for messages
I sent a test message there and got an empty list instead of the message body

After digging into the library a bit, I saw that the request returns the correct response, but the xml parser cannot parse it.

Environment parameters to reproduce the error:
Apple MacBook Air M1
OS: MacOS Sonoma 14.4.1
Python version: 3.12.0
Project libraries:
aiodns==3.2.0
aiohttp==3.9.5
aiokafka==0.10.0
aiosignal==1.3.1
aiosqs==1.0.5
annotated-types==0.6.0
async-timeout==4.0.3
attrs==23.2.0
boto3==1.34.97
botocore==1.34.97
Brotli==1.1.0
cffi==1.16.0
frozenlist==1.4.1
graypy==2.1.0
idna==3.7
jmespath==1.0.1
lxml==5.2.1
multidict==6.0.5
packaging==24.0
pycares==4.4.0
pycparser==2.22
pydantic==2.7.1
pydantic-settings==2.2.1
pydantic_core==2.18.2
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.1
s3transfer==0.10.1
six==1.16.0
typing_extensions==4.11.0
urllib3==2.2.1
yarl==1.9.4

Code sample:

import asyncio
from aiosqs import SQSClient

from settings.settings import settings


async def main():
    async with SQSClient(
        aws_access_key_id=settings.aws_access_key,
        aws_secret_access_key=settings.aws_access_secret,
        region_name=settings.aws_region_name,
        host=settings.aws_host,
    ) as client:

        queue_url = await client.get_queue_url(settings.aws_sqs_queue_name)

        while True:
            message = await client.receive_message(
                queue_url=queue_url['QueueUrl'],
                max_number_of_messages=1,
                visibility_timeout=3,
                wait_time_seconds=3
            )

            if message is not None:
                print(f"Received message: {message}")
                # await client.delete_message(receipt_handle=message['ReceiptHandle'], queue_url=queue_url['QueueUrl'])
            await asyncio.sleep(1)


if __name__ == "__main__":
    asyncio.run(main())

Console output:

Received message: []
Received message: []
...
@d3QUone
Copy link
Owner

d3QUone commented May 6, 2024

I saw that the request returns the correct response, but the xml parser cannot parse it.

@NazikXY please share the exact XML response you got

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants