serverless-operations / serverless-lambda-edge-pre-existing-cloudfront

A Serverless Framework plugin to create your Lambda@Edge against a pre-existing CloudFront.
Other
56 stars 17 forks source link

Deploy hook not firing #5

Open jwerre opened 4 years ago

jwerre commented 4 years ago

Not sure whats happening but when I deploy CloudFront trigger is not attached. It appears the after:aws:deploy:finalize:cleanup hook is not triggering. Here's my yaml if that helps:

---
service: my-lambda-edge

provider:
  name: aws
  region: us-east-1
  stage: ${opt:stage, 'staging'}
  runtime: nodejs12.x
  timeout: 120
  stackName: ${self:service}-${self:provider.stage}
  logRetentionInDays: 90
  deploymentBucket:
    name: my-lambda-edge-bucket
  role: my-iam-role
  environment:
    NODE_ENV: ${self:provider.stage}

custom:
  distributions:
    staging: -------------
    production: -------------
  lambdaEdgePreExistingCloudFront:
    validStages:
      - staging
      - production

package:
  exclude:
    - ./**
  include:
    - functions/*.js

functions:

  request:
    handler: functions/request.handler
    events:
      - preExistingCloudFront:
          distributionId: ${self:custom.distributions.${opt:stage, self:provider.stage}}
          eventType: origin-request
          pathPattern: '*'
          includeBody: false

  response:
    handler: functions/response.handler
    events:
      - preExistingCloudFront:
          distributionId: ${self:custom.distributions.${opt:stage, self:provider.stage}}
          eventType: origin-response
          pathPattern: '*'
          includeBody: false

plugins:
  - serverless-lambda-edge-pre-existing-cloudfront
sls --version
Framework Core: 1.76.1
Plugin: 3.6.17
SDK: 2.3.1
Components: 2.32.0
jwerre commented 4 years ago

I figured out the issue. If you deploy with the default stage and don't supply --stage flag the deployment hook is not triggered.