All Projects → vkkis93 → serverless-step-functions-offline

vkkis93 / serverless-step-functions-offline

Licence: MIT license
Emulate step functions locally when developing your Serverless project

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to serverless-step-functions-offline

Trapheus
This tool automates restoration of RDS database instances from snapshots into any dev, staging or production environments. It supports individual RDS Snapshot as well as cluster snapshot restore operations.
Stars: ✭ 68 (-8.11%)
Mutual labels:  state-machine, step-functions
React-Machinery
🔥 React Machinery provides a simple to use, component based approach to state machines in react.
Stars: ✭ 104 (+40.54%)
Mutual labels:  state-machine
Aws Etl Orchestrator
A serverless architecture for orchestrating ETL jobs in arbitrarily-complex workflows using AWS Step Functions and AWS Lambda.
Stars: ✭ 245 (+231.08%)
Mutual labels:  state-machine
xoid
Framework-agnostic state management library designed for simplicity and scalability ⚛
Stars: ✭ 96 (+29.73%)
Mutual labels:  state-machine
Xstate
State machines and statecharts for the modern web.
Stars: ✭ 18,300 (+24629.73%)
Mutual labels:  state-machine
react-transition-state
Zero dependency React transition state machine.
Stars: ✭ 239 (+222.97%)
Mutual labels:  state-machine
Vue Save State
A Vue mixin to save the state of a component to local storage
Stars: ✭ 243 (+228.38%)
Mutual labels:  state-machine
bloc
A predictable state management library that helps implement the BLoC design pattern
Stars: ✭ 12 (-83.78%)
Mutual labels:  state-machine
public
BitDust project source codes : official Public Git repository (mirror on GitHub) : https://bitdust.io
Stars: ✭ 19 (-74.32%)
Mutual labels:  state-machine
aws-genomics-workflows
Genomics Workflows on AWS
Stars: ✭ 131 (+77.03%)
Mutual labels:  step-functions
Text101-Original
A basic state-machine based text adventure exercise as part of our Complete Unity C# Developer course (http://gdev.tv/cudgithub)
Stars: ✭ 43 (-41.89%)
Mutual labels:  state-machine
xstate-react-router
XState connector to React Router.
Stars: ✭ 23 (-68.92%)
Mutual labels:  state-machine
yieldmachine
Components for State Machines, using Generator Functions
Stars: ✭ 23 (-68.92%)
Mutual labels:  state-machine
Stateless
Go library for creating state machines
Stars: ✭ 247 (+233.78%)
Mutual labels:  state-machine
ordered
Entropy-controlled contexts in Python
Stars: ✭ 36 (-51.35%)
Mutual labels:  state-machine
Api Generator
PHP-code generator for Laravel framework, with complete support of JSON-API data format
Stars: ✭ 244 (+229.73%)
Mutual labels:  state-machine
StateArts
Intellij plugin that creates state machine diagram from state machine
Stars: ✭ 87 (+17.57%)
Mutual labels:  state-machine
vrrm
rough code for running consensus
Stars: ✭ 18 (-75.68%)
Mutual labels:  state-machine
flviz
FLVIz - Finite Automata Simulator written in QT/Graphviz
Stars: ✭ 36 (-51.35%)
Mutual labels:  state-machine
StateBuilder
State machine code generator for C++ and Java.
Stars: ✭ 30 (-59.46%)
Mutual labels:  state-machine

serverless npm version Known Vulnerabilities Maintainability NPM

serverless-step-functions-offline

⚠️ Version 2.0 with breaking changes see usage ⚠️

Documentation

Install

Using NPM:

npm install serverless-step-functions-offline --save-dev

or Yarn:

yarn add serverless-step-functions-offline --dev

Setup

Add the plugin to your serverless.yml:

# serverless.yml

plugins:
  - serverless-step-functions-offline

To verify that the plugin works, run this in your command line:

sls step-functions-offline

It should rise an error like that:

Serverless plugin "serverless-step-functions-offline" initialization errored: Please add ENV_VARIABLES to section "custom"

Requirements

This plugin works only with serverless-step-functions.

You must have this plugin installed and correctly specified statemachine definition using Amazon States Language.

Example of statemachine definition you can see here.

Usage

After all steps are done, need to add to section custom in serverless.yml the key stepFunctionsOffline with properties stateName: name of lambda function.

For example:

service: ServerlessStepPlugin
frameworkVersion: ">=1.13.0 <2.0.0"
plugins:
   - serverless-step-functions-offline

# ...

custom:
  stepFunctionsOffline:
    FirstLambda: firstLambda #(v2.0)
    # ...
    # ...
    SecondLambda: secondLambda #(v2.0)

functions:
    firstLambda:
        handler: firstLambda/index.handler
        name: TheFirstLambda
    secondLambda:
        handler: secondLambda/index.handler
        name: TheSecondLambda
stepFunctions:
  stateMachines:
    foo:
      definition:
        Comment: "An example of the Amazon States Language using wait states"
        StartAt: FirstLambda
        States:
            FirstLambda:
              Type: Task
              Resource: arn:aws:lambda:eu-west-1:123456789:function:TheFirstLambda
              Next: SecondLambda
            SecondLambda:
              Type: Task
              Resource: arn:aws:lambda:eu-west-1:123456789:function:TheSecondLambda
              End: true

Where:

  • StepOne is the name of step in state machine
  • firstLambda is the name of function in section functions

Run Plugin

sls step-functions-offline --stateMachine={{name}} --event={{path to event file}}
  • name: name of state machine in section state functions. In example above it's foo.
  • event: input values for execution in JSON format (optional)

If you want to know where you are (in offline mode or not) you can use env variable STEP_IS_OFFLINE.

By default process.env.STEP_IS_OFFLINE = true.

What does plugin support?

States Support
Task At this moment plugin does not support fields Retry, Catch, TimeoutSeconds, HeartbeatSeconds
Choice All comparison operators except: And, Not, Or
Wait All following fields: Seconds, SecondsPath, Timestamp, TimestampPath
Parallel Only Branches
Pass Result, ResultPath
Fail Cause, Error
Succeed

Usage with serverless-webpack

The plugin integrates very well with serverless-webpack.

Add the plugins serverless-webpack to your serverless.yml file and make sure that serverless-webpack precedes serverless-step-functions-offline as the order is important:

  plugins:
    ...
    - serverless-webpack
    ...
    - serverless-step-functions-offline
    ...

TODOs

  • Support context object
  • Improve performance
  • Fixing bugs
  • Support Pass, Fail, Succeed
  • Integration with serverless-webpack
  • Add unit tests - to make plugin stable (next step)
  • Support fields Retry, Catch
  • Support other languages except node.js
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].