https://prefect.io logo
#prefect-community
Title
# prefect-community
k

Konstantin

04/21/2022, 1:57 PM
Hi team Prefect! I don't understand what could be the reason. Help
Copy code
51    secret = VaultSecret("/######/######/###/#####/").run()
52    File "/usr/local/lib/python3.9/site-packages/prefect/utilities/tasks.py", line 456, in method
53    return run_method(self, *args, **kwargs)
54    File "/usr/local/lib/python3.9/site-packages/prefect/tasks/secrets/vault_secret.py", line 171, in run
55    value = self._get_vault_secret(name)
56    File "/usr/local/lib/python3.9/site-packages/prefect/tasks/secrets/vault_secret.py", line 87, in _get_vault_secret
57    vault_creds = PrefectSecret(self.vault_credentials_secret).run()
58    File "/usr/local/lib/python3.9/site-packages/prefect/tasks/secrets/base.py", line 66, in run
59    return _Secret(name).get()
60    File "/usr/local/lib/python3.9/site-packages/prefect/client/secrets.py", line 140, in get
61    raise ValueError(
62  ValueError: Local Secret "VAULT_CREDENTIALS" was not found.
my code: from prefect.tasks.secrets.vault_secret import VaultSecret secret = VaultSecret("/######/########/###/#####/").run()
k

Kevin Kho

04/21/2022, 1:59 PM
It seems you are not authenticated to pull from Vault and need to set the credentials secret which is pulled by default? You can find that here
k

Konstantin

04/21/2022, 2:07 PM
I have exported these variables as described in the documentation article, these parameters are output on the server, in the agent, in the container. An error occurs when registering in the Prefect Flow
k

Kevin Kho

04/21/2022, 2:11 PM
It really seems you dont have the secret. You exported them in the place you are registering?
k

Konstantin

04/21/2022, 2:15 PM
how to check? where should the secret be located? I exported to a container with agent prefect
k

Kevin Kho

04/21/2022, 2:18 PM
it should exist as an environment variable where you register from, not the agent cuz this is during registration time
k

Konstantin

04/21/2022, 2:24 PM
tell me plz, in which container should I write?
k

Kevin Kho

04/21/2022, 2:25 PM
where do you register from? not in any of those right? where are you running that Python script when you get that error?
k

Konstantin

04/21/2022, 2:46 PM
registration takes place in ci/cd. in gitlab-ci.yml I added the line export of the variable PREFECT__CONTEXT__SECRETS__VAULT_CREDENTIALS='{"VAULT_T"}' But the error has not changed
k

Kevin Kho

04/21/2022, 2:53 PM
the only thing I can think of to debug here is to check if it’s making it in the script by printing the available environment variables. Like could you check what happens if you do
Copy code
import os
print(os.environ['PREFECT__CONTEXT__SECRETS__VAULT_CREDENTIALS'])
5 Views