Accessing Step Function ARN dynamically in Serverless Framework

I’m currently working on a project using the Serverless Framework, and I’m facing an issue. I have a Lambda function that needs to start a Step Function execution. However, I’m having trouble accessing the ARN of the Step Function dynamically within the Lambda function.

Here’s how I declare my step functions inside serverless.yml file:

stepFunctions:
  stateMachines:
    SubscriptionStateMachine:
      definition:
        StartAt: ChooseAction
        States:
          ChooseAction:
            Type: Choice
            Choices:
              - Variable: "$.changesType"
                StringEquals: "CANCEL"
                Next: CancelSubscription       
          CancelSubscription:
            Type: Task
            Resource:
              Fn::GetAtt: [ cancelSubscription, Arn ]
            End: true

And here’s the Lambda function code:

async function processMessage(message) {
  const stateMachineArn = process.env.STATE_MACHINE_ARN;

  const params = {
    stateMachineArn,
    input: JSON.stringify({
      changesType: "CANCEL", 
      ...JSON.parse(message.Body), 
    }),
  };