After the release of Prefect 2.13.7, I can no long...
# ask-community
m
After the release of Prefect 2.13.7, I can no longer have blocks with "SecretStr" in them? RuntimeError: no validator found for <class 'pydantic.types.SecretStr'>, see
arbitrary_types_allowed
in Config
Copy code
from prefect.blocks.core import Block
from pydantic import SecretStr


class SMTPCredentials(Block):
    server: str
    port: int
    user: str
    password: SecretStr
1
a
Can you try
from pydantic.v1 import SecretStr
?
m
that fixed it, thank you!
is this something I need to create an issue for, or is it now expected to use pydantic.v1 for SecretStr?
a
So it’s something we’re aware of but should do a better job communicating / throwing errors. Creating an issue can help remind us this is an important paper cut
b
woot - same error. fixed it 🙂
a
Nice! Thank goodness for slack search lol
b
1000%. The normal interwebs did not help me here.
l
I ran into this as well. In case someone stumbles upon this thread thru slack search, here’s a solution that works with both pydantic 1 and 2:
Copy code
try:
    from pydantic.v1 import SecretStr
except ImportError:
    from pydantic import SecretStr