Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix: Error notification when user does not have access to read from certain environments

Daniel Hougaarde970cc0f478a
diff --git a/frontend/src/hooks/api/secrets/constants.ts b/frontend/src/hooks/api/secrets/constants.ts
new file mode 100644
index 0000000000..97280c9026
--- /dev/null
+++ b/frontend/src/hooks/api/secrets/constants.ts
@@ -0,0 +1 @@
+export const ERROR_NOT_ALLOWED_READ_SECRETS = "You are not allowed to read on secrets";
diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx
index 8d0961ca5c..2a24dda47b 100644
--- a/frontend/src/hooks/api/secrets/queries.tsx
+++ b/frontend/src/hooks/api/secrets/queries.tsx
@@ -7,6 +7,7 @@ import { createNotification } from "@app/components/notifications";
import { apiRequest } from "@app/config/request";
import { useToggle } from "@app/hooks/useToggle";
+import { ERROR_NOT_ALLOWED_READ_SECRETS } from "./constants";
import {
GetSecretVersionsDTO,
SecretType,
@@ -135,11 +136,13 @@ export const useGetProjectSecretsAllEnv = ({
onError: (error: unknown) => {
if (axios.isAxiosError(error) && !isErrorHandled) {
const serverResponse = error.response?.data as { message: string };
- createNotification({
- title: "Error fetching secrets",
- type: "error",
- text: serverResponse.message
- });
+ if (serverResponse.message !== ERROR_NOT_ALLOWED_READ_SECRETS) {
+ createNotification({
+ title: "Error fetching secrets",
+ type: "error",
+ text: serverResponse.message
+ });
+ }
setIsErrorHandled.on();
}