{"library":"serverless-offline-edge-lambda","title":"Serverless Offline Edge Lambda","description":"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.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install serverless-offline-edge-lambda"],"cli":null},"imports":["plugins:\n  - serverless-offline-edge-lambda","custom:\n  offlineEdgeLambda:\n    path: '.build'","functions:\n  myFunction:\n    handler: src/handler.onViewerRequest\n    lambdaAtEdge:\n      distribution: 'MyDistribution'\n      eventType: 'viewer-request'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"npm install --save-dev serverless serverless-offline-edge-lambda\n\n# serverless.yml\nservice: edge-lambdas\n\nplugins:\n  - serverless-offline-edge-lambda\n\nprovider:\n  name: aws\n  runtime: nodejs12.x\n\nfunctions:\n  lambda:\n    handler: src/handlers.onViewerRequest\n    lambdaAtEdge:\n      distribution: 'WebsiteDistribution'\n      eventType: 'viewer-request'\n      pathPattern: '/lambda'\n\nresources:\n  Resources:\n    WebsiteDistribution:\n      Type: 'AWS::CloudFront::Distribution'\n      Properties:\n        DistributionConfig:\n          DefaultCacheBehavior:\n\n# Start offline\nnpx serverless offline start --port=3000","lang":"typescript","description":"Shows complete setup of serverless-offline-edge-lambda with a sample function and CloudFront distribution in serverless.yml, plus the command to start offline.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}