former2 icon indicating copy to clipboard operation
former2 copied to clipboard

TypeError: Cannot read properties of null (reading 'push') adding/generating ECS TaskDefinition with two containers

Open MikeJansen opened this issue 3 years ago • 1 comments

Been loving Former2 for the past year! This is the first time I've had an issue. Running locally with docker and local Edge extension, latest from repo (256bb99).

If I go into Compute and do EC2 instances, it's fine. If I go into ECS and do either Cluster or Task Definitions, I get the following. I'm pretty sure I've used Former2 for ECS stuff in the past with no problem. In this case, it's a Cluster and Task Definitions, no Service.

TypeError: Cannot read properties of null (reading 'push')
    at ecs.js:1015:42
    at Array.forEach (<anonymous>)
    at ecs.js:1014:58
    at Array.forEach (<anonymous>)
    at ecs.js:835:43
    at mappings.js:4791:25
    at Array.forEach (<anonymous>)
    at mappings.js:4789:39
    at Array.forEach (<anonymous>)
    at performF2Mappings (mappings.js:4775:13)
f2trace @ mappings.js:3
(anonymous) @ mappings.js:4802
(anonymous) @ mappings.js:4789
performF2Mappings @ mappings.js:4775
(anonymous) @ app.js:904
regenerateOutputs @ app.js:903
(anonymous) @ app.js:897
dispatch @ jquery-3.2.1.min.js:3
q.handle @ jquery-3.2.1.min.js:3

If I turn off Related Resources, I can Add the Cluster and Task Definition, but if I click Generate I get the error and just the cluster.

If I just Add the Task Definition, it adds without error, but if I Generate it gets the error and # No resources generated.

The Task Definition shown in Former2 is as follows. It has 2 containers and is a Fargate task with redactions.

   taskDefinitionArn: arn:aws:ecs:XXXXXXXXXX
    containerDefinitions:
        -
            name: snipe-mysql
            image: mysql:5.6
            cpu: 256
            memoryReservation: 768
            essential: true
            environmentFiles:
                -
                    value: arn:aws:s3:::XXXXXXXXXX
                    type: s3
            mountPoints:
                -
                    sourceVolume: snipesql-vol
                    containerPath: /var/lib/mysql
            logConfiguration:
                logDriver: awslogs
                options:
                    awslogs-group: /ecs/snipe-it-2
                    awslogs-region: us-east-1
                    awslogs-stream-prefix: ecs
        -
            name: snipe
            image: snipe/snipe-it:latest
            cpu: 256
            memoryReservation: 256
            essential: true
            environmentFiles:
                -
                    value: arn:aws:s3:::XXXXXXXXXX
                    type: s3
            dependsOn:
                -
                    containerName: snipe-mysql
                    condition: START
            logConfiguration:
                logDriver: awslogs
                options:
                    awslogs-group: /ecs/snipe-it-3
                    awslogs-region: us-east-1
                    awslogs-stream-prefix: ecs
    family: snipe-it-3
    taskRoleArn: arn:aws:iam::XXXXXXXXXX
    executionRoleArn: arn:aws:iam::XXXXXXXXXX
    networkMode: awsvpc
    revision: 1
    volumes:
        -
            name: snipesql-vol
            efsVolumeConfiguration:
                fileSystemId: fs-XXXXXXXXXX
                rootDirectory: /
                transitEncryption: ENABLED
                authorizationConfig:
                    accessPointId: fsap-XXXXXXXXXX
                    iam: DISABLED
    status: ACTIVE
    requiresAttributes:
        -
            name: com.amazonaws.ecs.capability.logging-driver.awslogs
        -
            name: ecs.capability.execution-role-awslogs
        -
            name: ecs.capability.efsAuth
        -
            name: com.amazonaws.ecs.capability.docker-remote-api.1.19
        -
            name: ecs.capability.efs
        -
            name: ecs.capability.env-files.s3
        -
            name: com.amazonaws.ecs.capability.docker-remote-api.1.21
        -
            name: com.amazonaws.ecs.capability.task-iam-role
        -
            name: ecs.capability.container-ordering
        -
            name: com.amazonaws.ecs.capability.docker-remote-api.1.25
        -
            name: com.amazonaws.ecs.capability.docker-remote-api.1.18
        -
            name: ecs.capability.task-eni
    compatibilities:
        - EC2
        - FARGATE
    runtimePlatform:
        operatingSystemFamily: LINUX
    requiresCompatibilities:
        - FARGATE
    cpu: 512
    memory: 1024
    registeredAt:
        
    registeredBy: XXXXXXXXXX

MikeJansen avatar Jul 20 '22 12:07 MikeJansen

Hey @MikeJansen,

Thanks for raising!

Looks like there was a slight mistake when compiling outputs for container definitions with environment files. I've added a fix now. Could you pull from latest and see if that fixes your issue?

iann0036 avatar Jul 21 '22 00:07 iann0036