Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing permission lambda:EnableReplication when trying to deploy a Lambda@Edge #36

Open
pherrymason opened this issue Jul 21, 2022 · 1 comment

Comments

@pherrymason
Copy link

As the title says, I'm trying to deploy a Lambda@Edge, and I'm getting the following error:

ServerlessError: Lambda@Edge cannot enable replication for the specified Lambda function.
Update the IAM policy to add permission: lambda:EnableReplication* for 
resource: arn:aws:lambda:us-east-1:xxxxxxxxxx:function:XXXZZZZYYYYY:2 and try again.

There's little documentation about this error in internet, but the little I've found pointed to add a permission to the lambda function:

EdgeAuthEnableReplicationPermission:
      Type: 'AWS::Lambda::Permission'
      Properties:
        Action: "lambda:EnableReplication"
        FunctionName: "XXXZZZZYYYYY"
        Principal: "*"

This is my serverless.yml file:

service: lambda-test
  useDotenv: true
  provider:
    name: aws
    region: 'us-east-1'
    stage: 'sbx'
    versionFunctions: true

  plugins:
    - serverless-lambda-edge-pre-existing-cloudfront

  functions:
    countryResolver:
      name: 'XXXZZZZYYYYY'
      handler: src/index.js
      events:
      - preExistingCloudFront:
          distributionId: 'zzzzzzzz'
          eventType: 'origin-request'
          pathPattern: '*'
          includeBody: false
          stage: sbx
  resources:
    Resources:
      IamRoleLambdaExecution:
        Type: "AWS::IAM::Role"
        Properties:
          AssumeRolePolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Principal:
                  Service:
                    - lambda.amazonaws.com
                    - edgelambda.amazonaws.com
                Action: sts:AssumeRole
      EdgeAuthEnableReplicationPermission:
        Type: 'AWS::Lambda::Permission'
        Properties:
          Action: "lambda:EnableReplication"
          FunctionName: "XXXZZZZYYYYY"
          Principal: "*"
@mohrash92
Copy link

I am running into the exact same problem, any luck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants