I've set a Prefect Cloud secret, but I get error a...
# ask-community
s
I've set a Prefect Cloud secret, but I get error as in the screenshot. The prefect doc says "Secrets are resolved locally first, falling back to Prefect Cloud (if supported)". What am I missing? I'm using below command to retrieve the secret.
Copy code
from prefect.client import Secret

GITHUB_ACCESS_TOKEN = Secret("GITHUB_ACCESS_TOKEN").get()
k
Hi @Sumit Kumar Rai. Try setting 
PREFECT__CLOUD__USE_LOCAL_SECRETS=false
s
Thanks @Kevin Kho it did work.
Is there an alternative to include the setting in the Prefect task as Python parameter?
k
You can pass it in the RunConfig. For local development, you can use the environment variable
a
shakes fist @Kevin Kho is so on the ball we community folks never get to answer these questions any more ๐Ÿ˜‚
๐Ÿ˜‚ 2
plus one 3
k
You can always chime in. I'm sure you have more to add ๐Ÿ™‚
s
Why doesn't it work like the doc says "Secrets are resolved locally first, falling back to Prefect Cloud (if supported)."? Is it a bug? If not shouldn't this be documented?
a
You'll have to refer to the core workflow doc on secrets too:
Copy code
For Cloud users, if the secret is not found in local context and config.cloud.use_local_secrets=False, the base Secret class queries the Prefect Cloud API for a stored secret.
So the idea is that if use_local_secrets is not false, only local secrets will be used, hence you set it fo false to allow cloud secrets as a fallback.
๐Ÿ‘ 1