diff --git a/platform/src/components/aws/service.ts b/platform/src/components/aws/service.ts index 46989a018..350b771a8 100644 --- a/platform/src/components/aws/service.ts +++ b/platform/src/components/aws/service.ts @@ -624,22 +624,19 @@ export class Service extends Component implements Link.Linkable { taskRoleArn: taskRole.arn, volumes: output(containers).apply((containers) => { const uniqueFileSystemIds: Set = new Set(); - return containers - .flatMap( - (container) => - container.volumes?.map((volume) => { - if (uniqueFileSystemIds.has(volume.efs)) return; - uniqueFileSystemIds.add(volume.efs); - return { - name: volume.efs, - efsVolumeConfiguration: { - fileSystemId: volume.efs, - transitEncryption: "ENABLED", - }, - }; - }), - ) - .filter((v) => !!v); + return containers.flatMap((container) => + (container.volumes ?? []).flatMap((volume) => { + if (uniqueFileSystemIds.has(volume.efs)) return []; + uniqueFileSystemIds.add(volume.efs); + return { + name: volume.efs, + efsVolumeConfiguration: { + fileSystemId: volume.efs, + transitEncryption: "ENABLED", + }, + }; + }), + ); }), containerDefinitions: $jsonStringify( all([