Can't use stepFunctions.startExecution with serverless-offline

I have a pretty bloated API running on API gateway ( comprising 6 services ). I’m trying to refactor and clean up some of the endpoints, for which step functions are an excellent use case. I’ve done the hard part of setting everything up and have everything configured, however I’ve hit a brick wall as far as my workflow goes.

I use serverless-offline as a crucial part of developing and testing the APIs offline. I’ve had no issues in the past, however now that I’ve added step functions into the mix, my local development workflow is broken.

Here’s my handler (API endpoint) that triggers the step function:

module.exports.handler = middy((event, context, callback) => {
  const { id } = JSON.parse(event.body);
  console.log(`received id: ${id}`);

  const stateMachineArn = process.env.statemachine_arn;
  console.log(JSON.parse(process.env.statemachine_arn));
  console.log({ stateMachineArn });
  const params = {
    stateMachineArn,
    input: JSON.stringify({
      id,
    }),
  };

  console.log("startting step function execution");
  stepFunctions.startExecution(params, (err, data) => {
    if (err) {
      console.log(err, err.stack);
      let res = {
        statusCode: 500,
        body: JSON.stringify({
          message: "Oops!",
        }),
      };

      callback(null, res);
    } else {
      console.log("success!");
      console.log({ data });
      let res = {
        statusCode: 200,
        body: JSON.stringify({
          message: "Success!",
        }),
      };

      callback(null, res);
    }
  });
}).use(cors());

The error is caused by an Invalid ARN, see the console log below:

received id: 123456789
{ stateMachineArn: '[object Object]' }

Everything works as expected once deployed as the ARN resolves to a string (as expected). But locally, it does not. The relevant portion of my serverless.yml file looks like this:

  myHandlerr:
    handler: src/handlers/myHandlerr.handler
    events:
      - http:
          method: POST
          path: /my/route
          cors: true
    environment:
      statemachine_arn: ${self:resources.Outputs.MyStateMachine${opt:stage}.Value}

I’ve looked into the serverless-step-functions-offline plugin, but I need more than just being able to invoke the standalone step function from the commandline. Does anyone have a solution to this?

Thanks!