<@ULVA73B9P> `AwsCredentials(region_name=None, pro...
# ask-marvin
b
@Marvin
AwsCredentials(region_name=None, profile_name=None, aws_access_key_id=None, aws_session_token=None, **aws_client_parameters={'config': None, 'verify': True, 'use_ssl': True, 'api_version': None, 'endpoint_url': None, 'verify_cert_path': None}**, aws_secret_access_key=None)
Which leads to
TypeError: unhashable type: 'dict'
whenever I try to work with the S3 bucket
@Nate is there a workaround for this? https://github.com/PrefectHQ/prefect/issues/13349
m
The issue you're encountering seems to revolve around how the
AwsCredentials
and
aws_client_parameters
are being handled within the Prefect framework, specifically leading to a
TypeError: unhashable type: 'dict'
. ### Key Points: 1. AWSCredentials Block: - The
AwsCredentials
class can be used within an
S3Bucket
block to provide authentication when interacting with an S3 bucket. - Example usage:
Copy code
my_s3_bucket = S3Bucket(
         bucket_name="my_s3_bucket",
         credentials=AWSCredentials.load("my_aws_credentials")
     )
2. Reported Issue: - The error
TypeError: unhashable type: 'dict'
occurs due to the way
aws_client_parameters
are stored. - This is often due to incorrect storage or handling of the parameters, especially when assigned through the UI. 3. Possible Solution: - Ensure that
aws_client_parameters
is properly initialized and not directly passed as a dictionary. - Use the helper methods to initialize
AwsCredentials
properly. ### GitHub Issues: - Issue #14147: Discusses the
TypeError
with similar configurations. - Issue #13349: Highlights how
aws_client_parameters
being stored as a dictionary leads to errors. References: - For more details on configuring and using
AwsCredentials
, you can refer to the Prefect documentation on Blocks and AWS integrations. - GitHub Issue: AWS Client Parameters Issue Try ensuring the
AwsCredentials
are properly instantiated according to the documentation, possibly avoiding direct dictionary assignment in the parameters. If the error persists, consult the open issues for updates or consider opening a new issue if your scenario slightly differs.
n
hi @Blake - is this an older version of prefect aws?
i think this has been fixed
b
Thanks @Nate
Im now running into this:
Copy code
File ".venv/lib/python3.11/site-packages/prefect_aws/credentials.py", line 143, in get_boto3_session
    aws_secret_access_key = self.aws_secret_access_key.get_secret_value()
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'get_secret_value'
Specifically when I am fetching a cached task result from result storage
n
hrm thats interesting - can you show the code that gets you to this error? ideally an MRE would be super helpful
b
Updating to latest prefect-aws + prefect 3.0 has resolved thid
n
👍