aws-map
aws-map copied to clipboard
Can't use undefined value as ARRAY reference
Hi, When running the program I get an error
Can't use an undefined value as an ARRAY reference at lib/AWS/Network/SecurityGroupMap.pm line 154.
Hi,
Sorry for not seeing this before (It kind of got lost between other stuff). Since the error is here: https://github.com/pplu/aws-map/blob/master/lib/AWS/Network/SecurityGroupMap.pm#L154
It would look like you have an ELBv2 with no SecurityGroups. Can you do a DescribeLoadBalancers in the ELBv2 API (can be done with the AWS CLI) and send me the results? (please redact any identifying or delicate information).
This will probably be solved by adding a return if (not defined $elb->SecurityGroups)
on line 153.
Can you try that and report if it worked?
Hello !
I've got the same error," Can't use an undefined value as an ARRAY reference at lib/AWS/Network/SecurityGroupMap.pm line 154"
I've added :
return if (not defined $elb->SecurityGroups)
on the line 153 but then I have too many errors.
Can I have some help please ?
Thank's !
but then I have too many errors.
Can you attach the errors?
"my" variable $elb masks earlier declaration in same scope at lib/AWS/Network/SecurityGroupMap.pm line 154. "my" variable $sg masks earlier declaration in same statement at lib/AWS/Network/SecurityGroupMap.pm line 155. "my" variable $elb masks earlier declaration in same statement at lib/AWS/Network/SecurityGroupMap.pm line 155. Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 167, at end of line (Missing operator before ?) Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 180, at end of line (Missing operator before ?) Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 207, at end of line (Missing operator before ?) Use of my $_ is experimental at lib/AWS/Network/SecurityGroupMap.pm line 210. Use of my $_ is experimental at lib/AWS/Network/SecurityGroupMap.pm line 210. Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 210, at end of line (Missing operator before ?) Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 211, at end of line (Missing operator before ?) Array found where operator expected at lib/AWS/Network/SecurityGroupMap.pm line 220, at end of line (Missing operator before ?) syntax error at lib/AWS/Network/SecurityGroupMap.pm line 154, near ") foreach " syntax error at lib/AWS/Network/SecurityGroupMap.pm line 157, near "}" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 167, near "->@" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 170, near "}" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 180, near "->@" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 183, near "}" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 200, near "}" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 207, near "->@" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 211, near "->@" syntax error at lib/AWS/Network/SecurityGroupMap.pm line 220, near "->@*" lib/AWS/Network/SecurityGroupMap.pm has too many errors. Compilation failed in require at bin/map-webserver line 3. BEGIN failed--compilation aborted at bin/map-webserver line 3.
Thank you ! ;)
@Hindmalti : the way I had suggested the fix there was a syntax error (missing ;
) at the end of the line. I've pushed to master correct code.
If you still get errors it could be because you're using a very old Perl (aws-map needs Perl > 5.18 https://github.com/pplu/aws-map/issues/7). You can use https://perlbrew.pl/ to get a modern Perl running, or take a look at running aws-map from a Docker container (you have a working Dockerfile in the project).
Please tell me if this helped.
@Hindmalti : did you finally get this working?