A Serverless Framework plugin (v1.3.1, last updated August 2023) that simulates AWS CloudFront Edge Lambda behavior in local development, enabling testing of viewer-request, viewer-response, origin-request, and origin-response events without deploying to AWS. Unlike serverless-offline (which it cannot be used with), it targets CloudFront edge functions specifically, supporting custom headers, transpilers (serverless-webpack, serverless-plugin-typescript serverless-bundle, esbuild), hot reload via chokidar, and configuration through serverless.yml. Requires serverless >=1.36.0 and ships TypeScript types. Release cadence is sporadic with minor fixes and features.
npm install serverless-offline-edge-lambdaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows complete setup of serverless-offline-edge-lambda with a sample function and CloudFront distribution in serverless.yml, plus the command to start offline.
Use only serverless-offline-edge-lambda for CloudFront edge testing; do not install serverless-offline.
Specify custom.offlineEdgeLambda.path to point to the output directory of your transpiler (e.g., '.build', '.webpack/service').
Set provider.runtime to nodejs14.x, nodejs16.x, or nodejs18.x as needed.
Run npm install --save-dev serverless-offline-edge-lambda
Add 'serverless-offline-edge-lambda' to the plugins list.
Remove serverless-offline from dependencies.
Ensure handler format is like 'src/handlers.onViewerRequest' with function name after the dot.