workload-discovery-on-aws icon indicating copy to clipboard operation
workload-discovery-on-aws copied to clipboard

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

Open speedydreser opened this issue 1 year ago • 7 comments

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

speedydreser avatar Oct 05 '23 17:10 speedydreser

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.

svozza avatar Oct 05 '23 17:10 svozza

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

lajtosadam avatar Oct 11 '23 15:10 lajtosadam

I use a Version: v2.0.3.

speedydreser avatar Oct 11 '23 20:10 speedydreser

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.

svozza avatar Oct 31 '23 10:10 svozza

~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')])

JacobReynolds avatar Dec 06 '23 22:12 JacobReynolds

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

omri-shilton avatar Jan 01 '24 12:01 omri-shilton

@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 avatar Feb 09 '24 17:02 svozza

This was fixed in v2.1.6.

svozza avatar Apr 12 '24 10:04 svozza