aws-solutions / workload-discovery-on-aws

Workload Discovery on AWS is a solution to visualize AWS Cloud workloads. With it you can build, customize, and share architecture diagrams of your workloads based on live data from AWS. The solution maintains an inventory of the AWS resources across your accounts and regions, mapping their relationships and displaying them in the user interface.
https://aws.amazon.com/solutions/implementations/workload-discovery-on-aws/
Apache License 2.0
727 stars 88 forks source link

unsupported operand type(s) for *: 'NoneType' and 'float' #458

Closed speedydreser closed 7 months ago

speedydreser commented 1 year ago

I am currently having problems when exporting a diagram to Drawio I get the following error: unsupported operand type(s) for *: 'NoneType' and 'float'

And I have not been able to find the origin of said err

svozza commented 1 year ago

What version of the solution are you using? We did add a fix to this for the new version (2.1.0) released a few weeks ago.

lajtosadam commented 1 year ago

I use a Version: v2.1.0, but i have the same issue.

speedydreser commented 1 year ago

I use a Version: v2.0.3.

svozza commented 1 year ago

So it looks like the fix released in v2.1.0 only partially fixed this bug. We will have to investigate what other edge cases are causing the problem. I have noticed that it is more likely to occur if multiple resources have been deleted from the canvas before export.

JacobReynolds commented 11 months ago

~One thing I've noticed is that if I import a VPC, and then use the filters to remove some subset of resources, export always breaks.~

I've made a little more progress and I think (?) the bug is here https://github.com/aws-solutions/workload-discovery-on-aws/blob/main/source/backend/functions/drawio/main.py#L188-L189. If the order of the incoming JSON results in a child being before a parent, that child never gets added to the children array of its parent. An ugly solution is commenting out those two lines and following up with a subsequent for loop of:

    for node in nodes:
        parent = node.get('parent')
        if parent:
            node_dict[parent].add_child(node_dict[node.get('id')])
omri-shilton commented 10 months ago

we are using v2.1.3 and also experiencing this, is there any updates on this issue?

svozza commented 9 months ago

@JacobReynolds is correct and so is the fix posted. I have tidied up the lambda function a bit and added steps on how to patch in this comment.

svozza commented 7 months ago

This was fixed in v2.1.6.