silvermine / serverless-plugin-cloudfront-lambda-edge

Adds Lambda@Edge support to Serverless
MIT License
296 stars 41 forks source link

Does this not work with existing Distribution Id? #36

Closed jonathanalberghini closed 5 years ago

jonathanalberghini commented 5 years ago

I have the below code and get the following error Could not find resource with logical name "E3QDJSNRIE!!!!"

Does this not work with existing Distribution Id?

plugins:

service: iam-lambdaedge-api # NOTE: update this with your service name frameworkVersion: ">=1.36.3"

provider: name: aws runtime: nodejs8.10 memorySize: 1024 # overwrite default memory of 1024 versionFunctions: false stage: ${opt:stage, 'dev'} region: us-east-1 timeout: 7 stackTags: # Optional CF stack tags application: ${self:provider.stage} - ${self:service.name} tags: # Optional service wide function tags stage: ${opt:stage, self:provider.stage}

custom: distribution: prod: ETWLECI9S!!!! #not real one dev: E3QDJSNRIE!!!! stage: ${opt:stage, self:provider.stage}

functions: redirecthandlerLG: name: "${self:provider.stage}-${self:service.name}-LG" handler: edgeHandler.edgeHandlerLG memorySize: 1024 timeout: 4 lambdaAtEdge:

    distribution: "${self:custom.distribution.${self:custom.stage}}"
    eventType: 'viewer-response'
  -
    distribution: "${self:custom.distribution.${self:custom.stage}}"
    eventType: 'viewer-request'
  -
    distribution: "${self:custom.distribution.${self:custom.stage}}"
    eventType: 'origin-request'
jthomerson commented 5 years ago

See #15