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 🙏

© 2026 – Pkg Stats / Ryan Hefner

serverless-local-ecr

v1.1.0

Published

Use a source handler for local Serverless invocation and an ECR image for deployment.

Downloads

223

Readme

serverless-local-ecr

Use a normal source handler with serverless invoke local while deploying the same Lambda function as an Amazon ECR container image.

Serverless Framework does not natively invoke image-backed Lambda functions locally. This plugin keeps handler in place for local commands, then replaces it with image immediately before Serverless packages or deploys the function.

[!IMPORTANT] This plugin does not pull or run the ECR image locally. It invokes the configured source handler using Serverless Framework's normal local runtime.

Requirements

  • Node.js 18.18 or newer
  • Serverless Framework 3 or 4
  • AWS provider

Installation

npm install --save-dev serverless-local-ecr

Add the plugin to serverless.yml:

plugins:
  - serverless-local-ecr

Configuration

Define the local handler and use remoteImage in place of Serverless's standard function-level image property:

service: example

provider:
  name: aws
  runtime: nodejs20.x
  ecr:
    images:
      myImage:
        path: ./image

plugins:
  - serverless-local-ecr

functions:
  myFunction:
    handler: src/handler.main
    remoteImage:
      name: myImage

remoteImage accepts the same common forms as Serverless's image setting:

functions:
  namedImage:
    handler: src/named.main
    remoteImage: myImage

  ecrUri:
    handler: src/existing.main
    remoteImage:
      uri: 123456789012.dkr.ecr.us-east-1.amazonaws.com/my-image:latest
      command:
        - src/existing.main

Now the two workflows use different representations of the same function:

# Runs src/handler.main from the local source tree.
serverless invoke local --function myFunction

# Replaces handler with image before creating deployment artifacts.
serverless package
serverless deploy

# The transformation also applies to individual function deployments.
serverless deploy function --function myFunction

Defining remoteImage without handler, or defining both remoteImage and image, is rejected with a configuration error.

Drawbacks and limitations

Local invocation does not test the artifact that is deployed. A successful local invocation can still result in a broken Lambda image because this plugin does not validate:

  • the Dockerfile or image build;
  • the container entry point, command, or working directory;
  • dependencies and files installed or copied only inside the image;
  • Linux-native binaries, filesystem permissions, or the container user;
  • differences between ARM64 and x86_64 architectures;
  • the Lambda Runtime Interface Client or Runtime Interface Emulator;
  • environment variables and filesystem layout supplied by the image.

The source handler and the container entry point can also drift over time. Test the built image separately when container fidelity matters. For example, run it with Docker and the AWS Lambda Runtime Interface Emulator, or use AWS SAM CLI's local invocation support.

The plugin changes Serverless's in-memory function configuration during packaging. Although the integration is covered by tests, Serverless lifecycle or configuration internals can change between major releases. Pin Serverless to a version validated by your project and test upgrades before adopting them.

Finally, serverless invoke local is an emulator even for handler-based functions. It does not reproduce every AWS Lambda service behavior, IAM permission, or event source.

Development

npm install
npm run check

See CONTRIBUTING.md for the release and compatibility workflow.

License

ISC