Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: joinList.filter is not a function #41

Closed
asifiqbal opened this issue Jul 11, 2021 · 4 comments
Closed

TypeError: joinList.filter is not a function #41

asifiqbal opened this issue Jul 11, 2021 · 4 comments

Comments

@asifiqbal
Copy link

I am getting another error. Not sure if it related to my previous issue about npm warn

~ → cfn-dia draw.io -t quickstart-atlassian-jira/templates/quickstart-jira-dc-with-vpc.template.yaml
/usr/local/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:9
        joinList.filter(
                 ^

TypeError: joinList.filter is not a function
    at createPseudoResources (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:9:18)
    at createPseudoResources (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:36:7)
    at createPseudoResources (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:36:7)
    at Object.createPseudoResources (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:36:7)
    at Object.generate (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/graph/MxGenerator.js:244:12)
    at Command.<anonymous> (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/commands/draw.io/index.js:37:23)
    at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/node_modules/commander/index.js:922:31)
    at Command._parseCommand (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/node_modules/commander/index.js:1503:14)
    at Command._dispatchSubcommand (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/node_modules/commander/index.js:1443:18)
    at Command._parseCommand (/usr/local/lib/node_modules/@mhlabs/cfn-diagram/node_modules/commander/index.js:1460:12)

Here is the template

https://github.com/aws-quickstart/quickstart-atlassian-jira/blob/main/templates/quickstart-jira-dc-with-vpc.template.yaml

@robbrad
Copy link
Contributor

robbrad commented Feb 7, 2022

Seeing this issue as well

Cause by CF: !Join ["", !Split ["-", !GetAtt EFSFileSystem.FileSystemId]]

@robbrad
Copy link
Contributor

robbrad commented Feb 7, 2022

The issue is most likely due to https://stackoverflow.com/questions/55458675/filter-is-not-a-function

Non Array type
https://github.com/mhlabs/cfn-diagram/blob/670269150b4ca3234e32ca836546538e5a7e2fa5/resources/JsonUtil.js#L9

@ljacobsson - Do you concur?

Im trying to understand the code logic of the filter - basically if it's an object and not a ref or starts with AWS::

But Join will return a string always if im not mistaken so wont have the filter function

@kazanglenn
Copy link

I hit this problem when working with complex nested stacks.

I resolved the error locally by updating JsonUtil.js line 7, in createPseudoResources, to be

const joinList = [].concat(current[k]["Fn::Join"][1]);

as joinList is assumed to be an array, but there may not be elements to fill it.

With this change in place all the diagrams I required were generated without error.

@ljacobsson
Copy link
Owner

Thanks for this and sorry for the slow response. This should now be fixed

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

No branches or pull requests

4 participants