1
votes

i have been trying to build a stack in python using the CDK but when i run the cdk diff or cdk synth to see if the goes passes (not sure if that is the right way to validate your code) but usually works but now i have this error:

File "/home/user/workspace/test/cdk/pytest/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 368, in invoke return self._process.send(request, InvokeResponse) File "/home/user/workspace/test/cdk/pytest/.venv/lib/python3.8/site-packages/jsii/_kernel/providers/process.py", line 335, in send raise JSIIError(resp.error) from JavaScriptError(resp.stack) jsii.errors.JSIIError: Expected array type, got {"$jsii.byref":"@aws-cdk/aws-elasticloadbalancingv2.ApplicationTargetGroup@10005"}

This is the code:

        applicationTargetGroup = elbv2.ApplicationTargetGroup(self, 'ApplicationTargetGroup', 
                                target_type=elbv2.TargetType.IP,
                                target_group_name='stg-test',
                                protocol=elbv2.ApplicationProtocol.HTTP,
                                port=8080,
                                vpc=vpc,
                                health_check=elbv2.HealthCheck(path='/images/favicon.ico')
                                )

        httpsListener.add_target_groups('TargetGroups', 
                                target_groups=applicationTargetGroup, 
                                host_header='host.domain.com', 
                                priority=107)



  
1

1 Answers

1
votes

The error says: "Expected array type". So you should have in add_target_groups:

target_groups=[applicationTargetGroup],