Hello! I found this example showing how to use ste...
# help
j
Hello! I found this example showing how to use step functions: https://docs.serverless-stack.com/migrating-from-serverless-framework#serverless-step-functions But, what package should I require to use the
sfn
and
tasks
variable?
r
Those are from the AWS CDK: @aws-cdk/aws-stepfunctions and @aws-cdk/aws-stepfunctions-tasks
f
Thanks @Roger Chi!
Hey @Josimar Zimermann, as Roger suggested, add these 2 packages to ur package.json
Copy code
"@aws-cdk/aws-stepfunctions": "1.114.0",
    "@aws-cdk/aws-stepfunctions-tasks": "1.114.0",
And then run npm/yarn install
j
I am really sorry to necro a thread that is a month old but i'm getting
duration.toSeconds is not a function
when trying the SST step functions example with these packages, any advice for this? @Frank
f
Hey @Jack G can i see where you are ussing
duration.toSeconds
in ur code?
j
I'm not actually using it directly but it seems like that is what the
@aws-cdk/aws-stepfunctions
package is using, it seems to be throwing the error with this block of code (from the SST example)
const sWait = new sfn.Wait(this, "Wait", { time: sfn.WaitTime.duration(300), });
it's the value inside the duration function I think
f
Can you import this:
Copy code
import * as cdk from "@aws-cdk/core";
and then change the duration line to:
Copy code
const sWait = new sfn.Wait(this, "Wait", {
  time: sfn.WaitTime.duration(cdk.Duration.seconds(300)),
});
j
Perfect @Frank that seems to have solved the error, many thanks!
f
Thanks @Jack G. Just updated to the doc.