Skip to content

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

fix cross-project import sync

Matheus Nogueira03cbea953343
diff --git a/backend/src/ee/services/secret-replication/secret-replication-service.ts b/backend/src/ee/services/secret-replication/secret-replication-service.ts
index 2f94991090..825caa0f14 100644
--- a/backend/src/ee/services/secret-replication/secret-replication-service.ts
+++ b/backend/src/ee/services/secret-replication/secret-replication-service.ts
@@ -242,7 +242,7 @@ export const secretReplicationServiceFactory = ({
const foldersGroupedById = groupBy(importedFolders.filter(Boolean), (i) => i?.id as string);
await Promise.all(
nonReplicatedDestinationImports
- .filter(({ folderId }) => Boolean(foldersGroupedById[folderId][0]?.path as string))
+ .filter(({ folderId }) => Boolean(foldersGroupedById[folderId]?.[0]?.path as string))
// filter out already synced ones
.filter(
({ folderId }) =>
diff --git a/backend/src/services/secret/secret-queue.ts b/backend/src/services/secret/secret-queue.ts
index 78ae26547e..88e9df88b7 100644
--- a/backend/src/services/secret/secret-queue.ts
+++ b/backend/src/services/secret/secret-queue.ts
@@ -811,14 +811,14 @@ export const secretQueueFactory = ({
);
await Promise.all(
imports
- .filter(({ folderId }) => Boolean(foldersGroupedById[folderId][0]?.path as string))
+ .filter(({ folderId }) => Boolean(foldersGroupedById[folderId]?.[0]?.path as string))
// filter out already synced ones
.filter(
({ folderId }) =>
!deDupeQueue[
uniqueSecretQueueKey(
- foldersGroupedById[folderId][0]?.environmentSlug as string,
- foldersGroupedById[folderId][0]?.path as string
+ foldersGroupedById[folderId]?.[0]?.environmentSlug as string,
+ foldersGroupedById[folderId]?.[0]?.path as string
)
]
)
@@ -873,14 +873,14 @@ export const secretQueueFactory = ({
);
await Promise.all(
referencedFolderIds
- .filter((folderId) => Boolean(referencedFoldersGroupedById[folderId][0]?.path))
+ .filter((folderId) => Boolean(referencedFoldersGroupedById[folderId]?.[0]?.path))
// filter out already synced ones
.filter(
(folderId) =>
!deDupeQueue[
uniqueSecretQueueKey(
- referencedFoldersGroupedById[folderId][0]?.environmentSlug as string,
- referencedFoldersGroupedById[folderId][0]?.path as string
+ referencedFoldersGroupedById[folderId]?.[0]?.environmentSlug as string,
+ referencedFoldersGroupedById[folderId]?.[0]?.path as string
)
]
)