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

Return AioAWSResponse when using aiobotocore #8694

Closed
maresb opened this issue Mar 18, 2025 · 2 comments
Closed

Return AioAWSResponse when using aiobotocore #8694

maresb opened this issue Mar 18, 2025 · 2 comments
Labels

Comments

@maresb
Copy link

maresb commented Mar 18, 2025

Greetings! I'm reporting a recent regression in some tests I'm maintaining but didn't write myself. (Apologies if I'm missing some context, but I've tried to gather all the relevant information.)

The following is a MWE due to @kjagiello:

repro.py

import asyncio
from aiobotocore.session import get_session
from moto import mock_aws

session = get_session()


async def main():
    with mock_aws():
        async with session.create_client("ec2", region_name="eu-west-1") as client:
            await client.describe_instances()


asyncio.run(main())

Run with uv:

uvx --with aiobotocore==2.21.1 --with moto==5.1.1 -- python repro.py

The result is

TypeError: object bytes can't be used in 'await' expression

triggered by these lines.

According to aio-libs/aiobotocore#1320 (comment), this is a bug in moto because moto returns an AWSResponse instead of an AioAWSResponse. This bug was obscured in aiobotocore versions <2.21, but uncovered by the change in aio-libs/aiobotocore#1301.

@bpandola
Copy link
Collaborator

The moto package has no integration with or awareness of aiobotocore, so it wouldn't even be possible for moto to return an AioAWSResponse object. If there is a genuine defect in moto behavior that breaks a third party library, we would try to remedy that, but I don't think that's the case here. In fact, a cursory search turned up this discussion. If you scroll to the bottom, it seems there are recent workarounds to get the versions of moto and aiobotocore you are using to play nice with each other.

@thehesiod
Copy link
Contributor

ya my apologies I should have stated that aiobotocore is not supported, poor choice of words on my part. let's continue the discussion of workarounds on that other thread.

@bpandola bpandola closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants