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

@czlowiek488/serverless-step-functions-local

v0.2.4

Published

Run AWS step functions offline with Serverless

Downloads

12

Readme

serverless-step-functions-local

Run AWS step functions offline with Serverless!

This is a plugin for the Serverless Framework. It uses stepfunctions-localhost to emulate step functions with AWS' provided tool for local development.

Requirements

Install

npm install serverless-step-functions-local -D

Getting Started

You'll need to add this plugin to your serverless.yml. The plugins section should look something like this when you're done:

plugins:
  ...
  - serverless-step-functions
  - serverless-step-functions-local
  - serverless-offline-lambda
  - serverless-offline
  ...

Then, add a new section to config with accountId and region parameters:

custom:
  stepFunctionsLocal:
    accountId: 101010101010
    region: us-east-1

Although not neccessary, it's strongly recomended to add the folder with the downloaded step function executables to .gitignore. By default, this path is ./.step-functions-local.

The plugin binds to port 8083, this cannot be changed.

It also adds an environment variable for each created state machine that contains the ARN for it. These variables are prefixed by OFFLINE_STEP_FUNCTIONS_ARN_, so the ARN of a state machine named 'WaitMachine', for example could be fetched by reading OFFLINE_STEP_FUNCTIONS_ARN_WaitMachine.

Options

(These go under custom.stepFunctionsLocal.)

  • accountId (required) your AWS account ID
  • region (required) your AWS region
  • lambdaEndpoint (defaults to http://localhost:4000) the endpoint for the lambda service
  • path (defaults to ./.step-functions-local) the path to store the downloaded step function executables
  • TaskResourceMapping allows for Resource ARNs to be configured differently for local development
  • eventBridgeEvents allows sending EventBridge events on execution status changes
    • enabled (bool) enabled or disable this feature. Disabled by default.
    • endpoint Endpoint for sending events to eg. for serverless-offline-aws-eventbridge would be http://localhost:4010

Full Config Example

service: local-step-function

plugins:
  - serverless-step-functions
  - serverless-step-functions-local
  - serverless-offline-lambda
  - serverless-offline

provider:
  name: aws
  runtime: nodejs10.x


custom:
  stepFunctionsLocal:
    accountId: 101010101010
    region: us-east-1
    TaskResourceMapping:
      FirstState: arn:aws:lambda:us-east-1:101010101010:function:hello
      FinalState: arn:aws:lambda:us-east-1:101010101010:function:hello
    eventBridgeEvents:
      enabled: true
      endpoint: http://localhost:4010
  sqsUrl: http://localhost:4566/101010101010/example-queue

functions:
  hello:
    handler: handler.hello

stepFunctions:
  stateMachines:
    WaitMachine:
      definition:
        Comment: "An example of the Amazon States Language using wait states"
        StartAt: FirstState
        States:
          FirstState:
            Type: Task
            Resource: Fn::GetAtt: [hello, Arn]
            Next: send_message
          send_message:
            Type: Task
            Resource: arn:aws:states:::sqs:sendMessage
            Parameters:
              QueueUrl: ${self:custom.sqsUrl}
              "MessageBody.$": "$"
            Next: wait_using_seconds
          wait_using_seconds:
            Type: Wait
            Seconds: 10
            Next: FinalState
          FinalState:
            Type: Task
            Resource: Fn::GetAtt: [hello, Arn]
            End: true