nathanagez / aws-cdk-state-machine-asl

Convert your CDK state machine to an ASL file
26 stars 2 forks source link

GetAtt includes Arn in function name #1

Closed jrowen closed 2 years ago

jrowen commented 2 years ago

Great tool, thanks for putting it together. I'm running into an issue with Lambda function names. In my template, the definition often includes something like the following

   {
    "Fn::GetAtt": [
     "LambdaFunc3EFEE6DE",
     "Arn"
    ]
   },

The code parses this as LambdaFunc3EFEE6DEArn, which is not recognized the Lambda server running locally. In particular, the Arn suffix is causing the issue, as sam local will make the function available under LambdaFunc3EFEE6DE.

Is this expected behavior, and should I be structing my cdk files or running the local Lambda server differently to get around this issue?

elthrasher commented 2 years ago

@jrowen I ran into the same issue. Since my app was for demo purposes only, I used patch-package to do this which enabled me to use the extracted ASL with SAM. @nathanagez I'll be happy to open a PR if you're interested in that solution.

nathanagez commented 2 years ago

Thanks for reporting this issue @jrowen ! @elthrasher yes please, feel free to open a PR 🚀

elthrasher commented 2 years ago

@nathanagez I thought about getting elaborate, but wound up making it a one-liner :D