Registry / aws / serverless

serverless

JSON →
library4.34.0jsnpmunverified

The Serverless Framework is a powerful command-line interface (CLI) tool designed for deploying serverless applications, primarily leveraging AWS services like Lambda, API Gateway, and DynamoDB. It enables developers to define both their application code and the necessary cloud infrastructure using declarative YAML configurations. Currently in its v4 series (e.g., v4.34.0 as of the latest release info), it undergoes active development with frequent minor and patch releases. The framework supports multiple programming runtimes including Node.js, Python, Go, and Java. Key differentiators include its extensive extensibility via a plugin ecosystem, the recent integration of popular community plugins (e.g., AppSync, Prune) into its core, and built-in support for advanced features like Durable Functions and S3 Filesystem mounts for Lambda. It aims to optimize for cost-effectiveness, auto-scaling, and reduced maintenance by abstracting complex cloud provisioning, facilitating the entire application lifecycle from development to deployment.

awsdevops
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

The primary `serverless` package's `main` entry (`lib/serverless.js`) default-exports the `Serverless` class. This import pattern is mainly for plugin development, programmatic testing, or advanced framework extensions, not for end-user application code. For TypeScript, type definitions likely provide named exports for interfaces.

import Serverless from 'serverless';

This is a TypeScript-specific import for typing your `serverless.yml` configuration when working with programmatic interactions or creating strongly-typed plugins. The exact export path might vary based on how `index.d.ts` is structured, but it's common for configuration types to be exposed.

import type { ServiceConfig } from 'serverless';

The `ServerlessError` class is commonly used by plugins and framework extensions for consistent error reporting within the Serverless ecosystem. It's likely exported as a named export for both JavaScript and TypeScript consumption.

import { ServerlessError } from 'serverless';

This quickstart defines a basic AWS Lambda function with an API Gateway endpoint using `serverless.yml`. It shows a minimal configuration for a Node.js function, demonstrates environment variable usage, and includes typical CLI commands for deployment and local development.

service: my-serverless-app frameworkVersion: '4' provider: name: aws runtime: nodejs20.x region: us-east-1 environment: MY_API_KEY: ${env:MY_API_KEY, 'default_key'} functions: hello: handler: handler.hello events: - httpApi: path: /hello method: get plugins: - serverless-offline # Example plugin # handler.js // module.exports.hello = async (event) => { // return { // statusCode: 200, // body: JSON.stringify( // { // message: `Hello from Serverless! API Key: ${process.env.MY_API_KEY}`, // input: event, // }, // null, // 2 // ), // }; // }; # To deploy: # npm install -g serverless # sls deploy # To run locally with serverless-offline (if installed): # sls offline
serverless --version
Debug
Known footguns
breakingServerless Framework v4 introduced significant changes, including the integration of several popular community plugins (e.g., AppSync, Prune, Python Requirements) directly into the core. Users migrating from v3 should remove these plugins from their `serverless.yml` to avoid conflicts and utilize the built-in functionality.
breakingThe minimum Node.js version requirement for Serverless Framework v4 is Node.js 18.17.0 or higher. Running the framework with older Node.js versions will result in errors.
gotchaRecent versions of the Serverless Framework (`v4.33.1` and later) have implemented significant supply chain attack hardening, including pinning transitive dependencies with `npm-shrinkwrap.json` and replacing some third-party HTTP clients with Node.js built-in `fetch()`. While this improves security, users of older versions should be aware of potential vulnerabilities in their dependency trees.
breakingCustom Domain configuration is now built directly into the Serverless Framework core in v4. If you were using a `serverless-domain-manager` or similar plugin in v3, you should remove it and configure your custom domains using the new native `custom.customDomains` block in `serverless.yml`.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
26 hits · last 30 days
bytedance
5
gptbot
4
ahrefsbot
4
amazonbot
4
script
1
googlebot
1
Resources