Skip to content

Conversation

@pv-rudger
Copy link
Contributor

Filter 'Default' components, like in makeUniqueId to prevent the following issue:

Failed to generate diagram - Error: Unable to calculate a unique id for an empty set of components
/home/runner/.npm/_npx/b98735c91b702b55/node_modules/@aws-cdk/core/lib/private/uniqueid.js:33
        throw new Error('Unable to calculate a unique id for an empty set of components');
              ^
Error: Unable to calculate a unique id for an empty set of components
    at makeUniqueId (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/@aws-cdk/core/lib/private/uniqueid.js:33:15)
    at AwsEdgeResolver.findUniqueResourceId (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:83:44)
    at /home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:55:47
    at DiagramComponent.subTreeFindComponentRec (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:137:13)
    at DiagramComponent.subTreeFindComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:134:21)
    at /home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:140:23
    at Array.map (<anonymous>)
    at DiagramComponent.subTreeFindComponentRec (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:139:40)
    at DiagramComponent.subTreeFindComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:134:21)
    at AwsEdgeResolver.findTargetComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:54:47)

Filter 'Default' components, like in makeUniqueId to prevent issue:

```
Failed to generate diagram - Error: Unable to calculate a unique id for an empty set of components
/home/runner/.npm/_npx/b98735c91b702b55/node_modules/@aws-cdk/core/lib/private/uniqueid.js:33
        throw new Error('Unable to calculate a unique id for an empty set of components');
              ^
Error: Unable to calculate a unique id for an empty set of components
    at makeUniqueId (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/@aws-cdk/core/lib/private/uniqueid.js:33:15)
    at AwsEdgeResolver.findUniqueResourceId (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:83:44)
    at /home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:55:47
    at DiagramComponent.subTreeFindComponentRec (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:137:13)
    at DiagramComponent.subTreeFindComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:134:21)
    at /home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:140:23
    at Array.map (<anonymous>)
    at DiagramComponent.subTreeFindComponentRec (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:139:40)
    at DiagramComponent.subTreeFindComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/component/component.js:134:21)
    at AwsEdgeResolver.findTargetComponent (/home/runner/.npm/_npx/b98735c91b702b55/node_modules/cdk-dia/dist/src/diagram/aws/aws-edge-resolver.js:54:47)
```
@pistazie pistazie self-requested a review March 5, 2025 07:16
Copy link
Owner

@pistazie pistazie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this bit.

I think in order to get rid of CDK v1 support we'll need to localize uniqueID anyway (see discussion here).

I'll approve for now

@pv-rudger
Copy link
Contributor Author

Thanks for catching this bit.

I think in order to get rid of CDK v1 support we'll need to localize uniqueID anyway (see discussion here).

I'll approve for now

Thank you.

This is to prevent the error, which occurs when the components argument only contains a single 'Default', in the AWS function it gets filtered uniqueid.ts#L33 and throws an error on line 36

I still want to add tests for this, but I need additional time to understand how those work.

I am not sure how I can contribute to #51 it is unclear for me if this is only about removing the V1 support and how this relates to the uniqueid issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants