Serverless Offline is a Serverless Framework plugin that runs Lambda handlers and API Gateway-style HTTP routing on your machine for faster iteration.
Overview
Serverless Offline plugs into the Serverless Framework and starts local HTTP servers that mimic API Gateway request handling while invoking your Lambda handler code. It is aimed at shortening the edit-test cycle when you build serverless APIs without deploying to AWS for every change.
The plugin supports Velocity templates, lazy loading of handlers, authorizers, API keys, CORS, HTTPS, WebSockets, proxies, timeouts, and response parameters. CLI flags control ports, Docker-based handler execution, worker-thread versus in-process run modes, certificate validation skips for JWT authorizers, and WebSocket idle limits.
You install it as a dev dependency, register serverless-offline in serverless.yml, and start it with serverless offline or sls offline. Handler lifecycle behavior approximates AWS concurrency and idle termination, with optional reload on each request or Docker-isolated runtimes for Go, Java, Python, and Ruby.
It also exposes a local Lambda invoke endpoint so aws-sdk or AWS CLI calls can target emulated functions, listing function keys and external names after startup.
Key features
- Local API Gateway emulation
- Lambda handler invocation
- Velocity template support
- JWT and custom authorizers
- WebSocket endpoint
- Docker-based handler runs
- Configurable CORS and HTTPS
- Lambda.invoke compatibility
Use cases
- Develop Serverless APIs locally
- Test authorizers without deploy
- Invoke Lambdas via aws-sdk locally
- Debug WebSocket serverless handlers