Skip to content

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

fix: handle disabled/destroyed values in gcp sync

Scott Wilsonfd1afc2cbe9e
diff --git a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts b/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
index f0eb3ce881..5e6006d86b 100644
--- a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
+++ b/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts
@@ -71,8 +71,13 @@ const getGcpSecrets = async (accessToken: string, secretSync: TGcpSyncWithCreden
res[key] = Buffer.from(secretLatest.payload.data, "base64").toString("utf-8");
} catch (error) {
- // when a secret in GCP has no versions, we treat it as if it's a blank value
- if (error instanceof AxiosError && error.response?.status === 404) {
+ // when a secret in GCP has no versions, or is disabled/destroyed, we treat it as if it's a blank value
+ if (
+ error instanceof AxiosError &&
+ (error.response?.status === 404 ||
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ (error.response?.status === 400 && error.response.data.error.status === "FAILED_PRECONDITION"))
+ ) {
res[key] = "";
} else {
throw new SecretSyncError({