npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-offline-stepfunctions-plugin

v0.0.1

Published

This Serverless Offline plugin provides local support for Serverless Step Functions

Downloads

61

Readme

serverless-offline-stepfunctions-plugin

Overview

This Serverless Offline plugin provides local support for Serverless Step Functions. It creates state machines for every stepFunctions entry on a local step function emulator.

This plugin doesn't manage the local step function emulator. You need to install and start the emulator before using this plugin.

Tested emulators:

Installation

npm install serverless-offline-stepfunctions-plugin

OR

yarn add serverless-offline-stepfunctions-plugin

Usage

  1. Enable this plugin by editing your serverless.yml file and placing an serverless-offline-stepfunctions-plugin entry in the plugins section, placed above the serverless-offline plugin
  2. Create a offlineStepFunctions entry in the custom section.
  3. For each lambda task, add a task name -> lambda name pair. See serverless.yml example below.
  4. (Optional) Add a host and port property defining the emulator host and port. Default host is localhost and default port is 4584.
  5. (Optional) Add an accountId property. Default is 0123456789.

Example

serverless.yml:

plugins:
  # Note how this comes before serverless-offline
  - serverless-step-functions
  - serverless-offline-stepfunctions-plugin
  - serverless-offline

functions:
  hello:
    handler: src/hello.default
    
stepFunctions:
  stateMachines:
    Test:
      definition:
        Comment: Test Step Function
        StartAt: HelloWorld
        States:
          HelloWorld:
            Type: Task
            Resource:
              Fn::GetAtt: [HelloLambdaFunction, Arn]
            End: true

custom:
  offlineStepFunctions:
  	accountId: 0123456789
    host: localhost
    port: 4584
    functions:
	    HelloWorld: hello

Execute via AWS CLI

aws stepfunctions --endpoint http://localhost:4584 start-execution --state-machine-arn "arn:aws:states:us-east-1:0123456789:stateMachine:Test" --input '{"first": 1, "second": 2}'

Executing via AWS JS SDK

const AWS = require('aws-sdk');

const stepFunctions = new AWS.StepFunctions({
	endpoint: `http://localhost:4584`,
});

const response = stepFunctions
	.startExecution({
		stateMachineArn: 'arn:aws:states:us-east-1:0123456789:stateMachine:Test',
		input: JSON.stringify({{"first": 1, "second": 2}}),
	})
	.promise();

Comparison to other plugins

serverless-step-functions-offline

This plugin has an internal simulation of the Step Function API. It supports a subset of the API and runs independently of Serverless Offline. Because of this, it cannot support direct API calls from AWS JS SDK or CLI. For example, you cannot start state machine execution from lambda function. You can only start execution from the command line. Furthermore, it only supports NodeJS lambda tasks.

serverless-offline-step-functions

Like the plugin above it (serverless-step-functions-offline), this plugin internally simulates Step Functions. It has no support for AWS JS SDK or CLI and has implemented even less of the Step Functions API.

serverless-step-functions-local

This plugin downloads and wraps AWS's Step Functions Local and creates state machines for each stepFunctions entry. It's the closest to this plugin in terms of functionality. But the one main distinction is that it manages your Step Functions emulator for you, which also means you have to use its emulator. Which means you need Java to download and run Step Functions Local. On the contrary, serverless-offline-stepfunctions-plugin defers that decision and control, so you are free to use whatever emulator you wish.

Roadmap