Skip to content

ServerlessOffline

Dennis Lee edited this page May 21, 2026 · 1 revision

title: serverless-offline type: tool created: 2026-05-21 last_updated: 2026-05-21 related: ["radar/tools/Floci", "radar/techniques/LambdaUnitTesting"] sources: ["https://github.com/dherault/serverless-offline"] radar_quadrant: Tools radar_ring: Assess radar_position: center

serverless-offline

A Serverless Framework plugin that emulates AWS Lambda and API Gateway on a local machine, enabling rapid iteration on serverless functions without deploying to AWS on every change.

How It Works

The plugin intercepts Serverless Framework's serverless.yml configuration and spins up a local HTTP server that routes requests to Lambda handler functions. When a request arrives, the plugin invokes the corresponding handler in a local Node.js process, mimicking the Lambda execution environment.

Key behaviours:

  • Simulates API Gateway event payloads (headers, path parameters, query strings, body) passed to handlers.
  • Supports both REST API (http) and HTTP API (httpApi) Gateway event formats.
  • Handles Lambda responses and translates them back to HTTP responses.
  • Supports offline invocations of scheduled events and SQS-triggered functions via companion plugins.

Setup

Installation is a single dev dependency added to a Serverless project:

npm install serverless-offline --save-dev

Added to serverless.yml plugins block, then invoked with serverless offline. The local server starts on port 3000 by default.

Scope and Limitations

The plugin emulates API Gateway and Lambda invocation mechanics, not the full AWS runtime environment. It does not emulate:

  • IAM permissions (all local invocations succeed regardless of IAM policy).
  • VPC networking behaviour.
  • Lambda execution environment specifics (cold start timing, memory limits, ephemeral /tmp storage behaviour).
  • Non-HTTP triggers without companion plugins (S3, SNS, DynamoDB streams).

For complete AWS service emulation, radar/tools/Floci or LocalStack are the appropriate complement.

Position in Local AWS Development Stack

serverless-offline occupies a distinct layer from infrastructure emulators. It is framework-aware (reads serverless.yml) rather than protocol-aware (does not implement the AWS API). The two approaches are complementary: serverless-offline handles function invocation and routing; Floci handles AWS service calls made from within those functions.

Radar Assessment

serverless-offline sits in the Assess ring of the Tools quadrant, at center position. First studied via the GitHub repository. The plugin is mature (widely used in the Serverless Framework ecosystem, 5k+ stars) but requires commitment to the Serverless Framework as the deployment tool. Center position reflects that a trial is straightforward for any Serverless Framework project, but is not applicable outside that ecosystem. Remaining gate is a Serverless Framework project where local Lambda iteration speed is a constraint.

Clone this wiki locally