Hi! I see a very weird issue, where I can fetch th...
# ask-community
t
Hi! I see a very weird issue, where I can fetch the Secret locally fine, but when I register the flow, it failed for the Secret not exist in local error:
Copy code
ValueError: Local Secret "CRITEO_SECRET_KEEPS" was not found.
But running locally is totally fine:
Copy code
>>> prefect.client.Secret('CRITEO_SECRET_KEEPS').get()
'1stxxxxg'
Is there any possible reasons? I clearly defined the secret in local config file.
I also have the secret defined on Cloud as well btw.
k
Can you try setting
"PREFECT__CLOUD__USE_LOCAL_SECRETS" = "true"
?
Oh wait this is different one sec
Ok I tried it with a Docker Storage
Copy code
from prefect import Flow, task
from prefect.client.secrets import Secret
from prefect.storage import Docker

storage = Docker(base_image="prefecthq/prefect:0.15.5-python3.8")

x = Secret("TEST").get()

@task
def abc():
    x = Secret("TEST").get()
    return x

with Flow("test", storage=storage) as flow:
    abc(x)

flow.register("dsdc")
and it’s working fine. I think at this point, I might need a reproducible example (or you can share you code with me privately if you are comfortable and I can try to re-create the structure)
t
ok! I’ll try get you a reproducible code when I have
As a note of record, I solved this issue by moving this line from the parent level of the .py file into a function and then it worked:
Copy code
CRIETO_SECRET_KEEPS = get_secret('CRITEO_SECRET_KEEPS')
^this doesn’t work if in the parent level of a module somehow