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

Error in Fn::Join function #14

Closed
SanderKnape opened this issue Dec 7, 2020 · 1 comment
Closed

Error in Fn::Join function #14

SanderKnape opened this issue Dec 7, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@SanderKnape
Copy link

Hello. I ran this tool on a CloudFormation template generated by the AWS CDK. I managed to pinpoint the error to the below resource. More specifically, it's the Fn::Join within the ManagedPolicyArns that is causing the error:

{
  "Resources": {
    "CreateFunctionServiceRole58157AB4": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": "lambda.amazonaws.com"
              }
            }
          ],
          "Version": "2012-10-17"
        },
        "ManagedPolicyArns": [
          {
            "Fn::Join": [
              "",
              [
                "arn:",
                {
                  "Ref": "AWS::Partition"
                },
                ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
              ]
            ]
          }
        ]
      },
      "Metadata": {
        "aws:cdk:path": "CdkStack/CreateFunction/ServiceRole/Resource"
      }
    }
  }
}

I get the following error when generating a diagram for this template:

➜ cfn-dia draw.io -t cdk.out/CdkStack.template.json
(node:20057) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:10:37)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at Object.createPseudoResources (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/resources/JsonUtil.js:5:7)
    at generate (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/index.js:89:12)
    at Command.<anonymous> (/Users/sander/.nodenv/versions/12.4.0/lib/node_modules/@mhlabs/cfn-diagram/index.js:44:11)
(node:20057) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:20057) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@ljacobsson ljacobsson added the bug Something isn't working label Dec 7, 2020
ljacobsson added a commit that referenced this issue Dec 7, 2020
@ljacobsson
Copy link
Owner

Thanks for reporting. A fix is rolling out now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants