Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Error in version 0.4.8: TypeError: unhashable type: 'dict' #372

Closed
1 task
obendidi opened this issue Jan 24, 2024 · 3 comments · Fixed by #373
Closed
1 task

Error in version 0.4.8: TypeError: unhashable type: 'dict' #372

obendidi opened this issue Jan 24, 2024 · 3 comments · Fixed by #373
Assignees

Comments

@obendidi
Copy link

obendidi commented Jan 24, 2024

Latest release introduced client caching, and it hashes the credentials parameters for that (see #369)

This introduced a bug, when I upgraded to prefect-aws==0.4.8:

  File "/home/user/lib/flows/my_flow.py", line 64, in my_flow
    s3: S3Client = aws_block.get_client("s3")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/lib/.venv/lib/python3.11/site-packages/prefect/events/instrument.py", line 73, in inner
    raise exc
  File "/home/user/lib/.venv/lib/python3.11/site-packages/prefect/events/instrument.py", line 70, in inner
    return function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/lib.venv/lib/python3.11/site-packages/prefect_aws/credentials.py", line 170, in get_client
    return _get_client_cached(ctx=self, client_type=client_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/lib.venv/lib/python3.11/site-packages/prefect_aws/credentials.py", line 121, in __hash__
    hash(frozenset(self.aws_client_parameters.dict().items())),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'dict'

The usage of hash(frozenset()) seems correct to me, so maybe it's a backward compatibility issue ? I upgraded from a pretty old version ~0.2

Expectation / Proposal

Traceback / Example

@zzstoatzz
Copy link
Contributor

zzstoatzz commented Jan 24, 2024

hi @obendidi - thanks for the issue. looking into this now

would you be able to share the shape of what you have stored in your aws_client_parameters?

@zzstoatzz
Copy link
Contributor

reopening until the release is actually cut

@zzstoatzz zzstoatzz reopened this Jan 24, 2024
@zzstoatzz
Copy link
Contributor

hi @obendidi - prefect-aws v0.4.9 has now been released which should fix the hashing problem you raised here.

See #373 for details on the fix

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

Successfully merging a pull request may close this issue.

2 participants