pistazie / cdk-dia

Automated diagrams of CDK provisioned infrastructure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing instance family icons causing TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null error

SamuraiPrinciple opened this issue · comments

When trying to render a diagram containing C6I instance the following error occurs:

Failed to generate diagram - TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
node:internal/errors:484
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
    at new NodeError (node:internal/errors:393:5)
    at validateString (node:internal/validators:163:11)
    at Object.join (node:path:1172:7)
    at AwsIconSupplier.instanceIconByFamily (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-icon-supplier.js:82:46)
    at AwsIconSupplier.matchEC2InstanceIcon (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-icon-supplier.js:64:21)
    at AwsIconSupplier.matchIcon (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-icon-supplier.js:35:29)
    at AwsDiagramGenerator.generateCfnComponent (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-diagram-generator.js:154:40)
    at AwsDiagramGenerator.generateComponent (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-diagram-generator.js:78:30)
    at AwsDiagramGenerator.generateSubTree (/workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-diagram-generator.js:64:32)
    at /workspaces/aws-infrastructure/node_modules/cdk-dia/dist/src/diagram/aws/aws-diagram-generator.js:68:41 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v18.11.0

This is similar to the issue fixed by this commit - 90228a3

I was wondering if it'd be possible to add some sensible defaulting to the icon selection logic, so that if the perfect icon cannot be found some generic one is used instead in order to for the diagram generation to succeed.

Thanks for reporting. fixed in version 0.8.1

Thanks for picking this up - much appreciated :)