Hi guys,
Been fighting with the following for quite a bit and googling doesn’t help much…
I’ve been following a combination of:
https://serverless.com/plugins/serverless-step-functions/#current-gotcha and https://serverless.com/plugins/serverless-step-functions/#how-to-specify-the-statemachine-arn-to-environment-variables
Problem is if I follow the code as it is, first it complains about:
Trying to populate non string value into a string for variable ${opt:stage}. Please make sure the value of the property is a string.
So apparently the following somehow is not valid:
resources:
Outputs:
halfHourMachine:
Value:
Ref: HalfHourMachineDash${self:service}Dash${opt:stage}
So I am like, ok whatever, let’s go with ${self:provider.stage}
instead
resources:
Outputs:
halfHourMachine:
Value:
Ref: HalfHourMachineDash${self:service}Dash${self:provider.stage}
But then I got the following error:
Error: The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [HalfHourMachineDashms-pipedriveDashdev] in the Resources block of the template
For completeness here’s the relevant parts:
Step Function
stepFunctions:
stateMachines:
halfHourMachine:
name: halfHourMachine-${self:service}-${self:provider.stage}
definition:
StartAt: WaitSecondsTask
States:
WaitSecondsTask:
Type: Wait
SecondsPath: $.wait
Next: checkDealsAndUpdateIfOlderThan30MinutesTask
checkDealsAndUpdateIfOlderThan30MinutesTask:
Type: Task
Resource:
Fn::GetAtt: [checkDealsAndUpdateIfOlderThan30Minutes, Arn]
End: true
Environemnt
environment:
stage: ${self:provider.stage}
stepmachine_arn: ${self:resources.Outputs.halfHourMachine.Value}
Function to be called
functions:
checkDealsAndUpdateIfOlderThan30Minutes:
handler: index.checkDealsAndUpdateIfOlderThan30Minutes
Any help would be greatly appreciated!