Skip to content

running with ascii-art generates a parser.parse is not a function error #242

@dsilbergleithcu-godaddy

Description

Issue

When running all versions of cfn-diagram >= 1.1.38 (1.1.37 appears to be missing from npm), and using the flag ascii-art, an error is generated:

parser.parse is not a function

Running versions 1.1.36 or below generate the expected output.

To recreate the issue

Create a file for testing:

{"Resources": {"AnotherBucket": {"Type": "AWS::S3::Bucket"}, "ExampleLambda": {"Type": "AWS::Lambda::Function", "Properties": {"Handler": "index.handler", "Role": {"Fn::GetAtt": ["LambdaRole", "Arn"]}, "Code": {"ZipFile": "exports.handler = async (event) => { return 'Hello' }"}}}, "LambdaRole": {"Type": "AWS::IAM::Role", "Properties": {"AssumeRolePolicyDocument": {"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Principal": {"Service": ["lambda.amazonaws.com"]}, "Action": ["sts:AssumeRole"]}]}}}}}

Save this file to ./test.template.json.

Run the latest version using npx against the file

npx @mhlabs/cfn-diagram@1.1.40 ascii-art -t ./test.template.json

Observe the result:

parser.parse is not a function

Repeat for each version, descending, until you reach 1.1.36, you will see the same error. For example:

npx @mhlabs/cfn-diagram@1.1.39 ascii-art -t ./test.template.json

Note: 1.1.37 produces:

npm ERR! notarget No matching version found for @mhlabs/cfn-diagram@1.1.37.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.```

Runtime info

  • I'm on an M1 Mac running 14.7.4
  • I'm using node version: 20.12.1

Happy to provide any other helpful information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions