Mike Marinaccio

    Mike Marinaccio

    1 year ago
    I’m curious if anyone has run into a
    boto3.client()
    issue when running
    prefect agent ecs start
    . In short, I receive the following error:
    File "/Users/mike/.virtualenvs/reporting-Q7tyta-k/lib/python3.9/site-packages/prefect/utilities/aws.py", line 55, in get_boto_client
        return boto3.client(
    TypeError: boto3.client() got multiple values for keyword argument 'aws_access_key_id'
    From the looks of it, the below code snippet from
    prefect/utilities/aws.py
    is running, in my case, such that none of the
    kwargs.pop(...)
    conditionals are executed. My creds are being pulled from
    ~/.prefect/config.toml
    . This would mean that the code is adding duplicate keyword args to
    session.client()
    (since they also exist in **kwargs with
    None
    values). If I remove
    **kwargs
    , it works.
    if use_session:
            # see <https://boto3.amazonaws.com/v1/documentation/api/latest/guide/resources.html?#multithreading-multiprocessing>  # noqa
            session = boto3.session.Session()
            return session.client(
                resource,
                aws_access_key_id=aws_access_key or kwargs.pop("aws_access_key_id", None),
                aws_secret_access_key=aws_secret_access_key
                or kwargs.pop("aws_secret_access_key", None),
                aws_session_token=aws_session_token
                or kwargs.pop("aws_session_token", None),
                **kwargs
            )
    I’m running prefect version
    0.13.19
    . Am I overlooking something or did I stumble upon a bug? If so, happy to raise a ticket.
    j

    josh

    1 year ago
    Ah @Mike Marinaccio I think I can see why this would be a bug! Thanks for reporting 🙂, feel free to open an issue if you want, I’ll make a PR to adjust for this behavior!
    Mike Marinaccio

    Mike Marinaccio

    1 year ago
    Wow, you might’ve broken a record for time between an issue being reported and opening a PR! Thanks for jumping on it so quickly.