serverless-operations / serverless-step-functions

AWS Step Functions plugin for Serverless Framework ⚡️
Other
1.03k stars 203 forks source link

Logical names are not resolved inside notifications definition #582

Open psvaiter opened 1 year ago

psvaiter commented 1 year ago

This is a Bug Report

What went wrong?

I could not reference a Lambda ARN inside the notifications using the logical name declared in serverless.yml.

What did you expect should have happened?

The plugin should be able to normalize the function name as it does for Resource or role inside the state machine when Ref or Fn::GetAtt are used.

What was the config you used?

functions:
  send-email-on-failure:
    handler: path/to/file.handler

stepFunctions:
  stateMachines:
    workflow:
      name: ${self:service}
      role:
        Fn::GetAtt: ["StateMachineRole", "Arn"]
      notifications:
        FAILED:
          - lambda:
              Fn::GetAtt: [send-email-on-failure, Arn]

      ... more state machine definition code here

If I replace the function call inside the FAILED status by Fn::GetAtt: [SendDashemailDashonDashfailureLambdaFunction, Arn] everything works. That was tough to discover. 😅

What stacktrace or error message from your provider did you see?

UPDATE_FAILED: MyDashserviceDashworkflowNotificationsFAILEDEventRule (AWS::Events::Rule)
Parameter my-service-dev-send-email-on-failure is not valid. Reason: Provided Arn is not in correct format. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException; Request ID: <id>; Proxy: null)

Similar or dependent issues

None

Additional Data

I searched the codebase and could find only 3 references to what it seems the function that converts the logical name into the normalized name. I would expect there's a call to it inside the "compileNotifications.js" too.

image