Lambda@Edge function don't have trigger attached to them

Hello,

I have a question about Lambda@Edge’s support in Serverless.

What I did so far is that I’ve created a simple function that is just adding a header to a request.

My serverless.yml file has this in it

viewer-request:
    name: ${self:provider.stackName}-viewer-request
    handler: src/functions/viewer-request.handler
    memorySize: 128
    timeout: 4
    events:
      - cloudFront:
          eventType: viewer-request
          origin: s3://${self:custom.bucket}.s3.amazonaws.com/files

So this is deploying as it should. It deploys lambda, it creates Cloudfront distribution, but it doesn’t attach a trigger to lambda I’ve created. Although when I try to add trigger manually I can use existing trigger (so it is created, just not attached to my lambda)
Any idea why this happens or what I did wrong?

I’ve run into the same issue. Is there a solution?

Ensure you have the latest serverless version - I was using an old version (I updated to 2.25.2). e.g.

curl -o- -L https://slss.io/install | bash
or
npm install -g serverless
or
serverless upgrade

However - I’m getting the issue where, when I update a lambda, it doesn’t attach the Cloudfront trigger to the UPDATED lambda version.

However - I’m getting the issue where, when I update a lambda, it doesn’t attach the Cloudfront trigger to the UPDATED lambda version.

I am running into this exact same issue. Is this the expected outcome of this or am I misconfiguring the deployment?

I solved this problem via a plugin called

@silvermine/serverless-plugin-cloudfront-lambda-edge