I have a Prefect flow that fails when it is unpick...
# prefect-community
p
I have a Prefect flow that fails when it is unpickled, the error message is related to me decrypting variables in pydantic's Settings().. is there any good way to move forward and debug pickling issues like this?
k
Is that Prefect 1 or Prefect 2?
p
1.1.0
k
What is the exact error?
p
I'm using something similar to this:
Copy code
from pydantic import BaseSettings
from pydantic_kms_secrets import KMSSecretStr, decrypt_kms_secrets


class Settings(BaseSettings):
    env: str
    secrets_kms_key_id: str  # This model attribute must exist to decrypt secrets
    kms_secret_1: KMSSecretStr
    kms_secret_2: KMSSecretStr

    class Config:
        env_file = ".env"

settings = decrypt_kms_secrets(Settings())
which works without issue outside of Prefect in my main application
Copy code
Failed to load and execute flow run: FlowStorageError('An error occurred while unpickling the flow:\n  ClientError("An error occurred (ValidationException) when calling the Decrypt operation: 1 validation error detected: Value at \'ciphertextBlob\' failed to satisfy constraint: Member must have length greater than or equal to 1")')
k
Maybe you can store as a script to bypass the serialization?
p
is there some documentation that I could take a look at please for that?
k
Yep! see this
🙏 1