Can't retrieve secrets with Python SDK
linards-kalvans opened this issue · 3 comments
Running copy / past code from quick start:
if_client = InfisicalClient(ClientSettings(
client_id = os.environ.get('INFISICAL_MACHINE_ID'),
client_secret = os.environ.get('INFISICAL_TOKEN')
))
neo_host = if_client.getSecret(options = GetSecretOptions(
project_id = 'Hunome',
environment = 'dev',
secret_name = 'HNM_NEO4J_HOST'
))
I run into the following error:
Exception Traceback (most recent call last)
Cell In[29], line 6
1 from infisical_client import InfisicalClient, ClientSettings, GetSecretOptions
2 if_client = InfisicalClient(ClientSettings(
3 client_id = os.environ.get('INFISICAL_MACHINE_ID'),
4 client_secret = os.environ.get('INFISICAL_TOKEN')
5 ))
----> 6 neo_host = if_client.getSecret(options = GetSecretOptions(
7 project_id = 'Hunome',
8 environment = 'dev',
9 secret_name = 'HNM_NEO4J_HOST'
10 ))
File ~/project_path/.venv/lib/python3.11/site-packages/infisical_client/infisical_client.py:42, in InfisicalClient.getSecret(self, options)
41 def getSecret(self, options: GetSecretOptions) -> SecretElement:
---> 42 result = self._run_command(Command(get_secret=options))
44 return ResponseForGetSecretResponse.from_dict(result).data.secret
File ~/project_path/.venv/lib/python3.11/site-packages/infisical_client/infisical_client.py:36, in InfisicalClient._run_command(self, command)
33 response = json.loads(response_json)
35 if response["success"] == False:
---> 36 raise Exception(response["errorMessage"])
38 return response
Exception: [Bad request]: failed to find bot key
The auth (client id / secret) is fine, if I mess with that, HTTP 403 is reported. Project with the name provided as project_id (do not see any other ID for the project in web ui), environment and secret with the name exist. Was working like charm with the old SDK infisical==1.4.1
.
SDK: infisical-python==2.1.6 @ Python-3.11.6 on Linux
Hi @lincis! It seems that you haven't disabled End-to-end encryption (E2EE), which is required.
You can find the option to disable E2EE in your project settings. Let me know if that doesn't work for you!
@DanielHougaard, disabled E2EE for the project, but the result is still the same.
Sorry wrong information, was probably some cached results, checked again this morning, now it is fine.