Questions tagged [aws-lambda-edge]

AWS Lambda Edge or Lambda@Edge, lets user run AWS Lambda Functions across AWS edge locations globally using AWS-Cloudfront, which helps in sending responses to end users at the lowest latency.

AWS Lambda@Edge is a part of Amazon Web Services (AWS), which allows user to run AWS Lambda Functions across AWS edge locations globally.

It helps users in sending responses to their end users at the lowest latency by using AWS-CloudFront.

Lambda functions can be triggered by CloudFront events, such as requests for content to or from origin servers and viewers. Read More

Resources:

Documentation: What is AWS lambda@Edge?

Examples: Lambda@Edge

268 questions
75
votes
3 answers

Why do I get 'execution role must be assumable' error when trying to deploy to Lambda@Edge?

I am trying to deploy to Lambda@Edge within AWS, but when I click on 'Deploy' I get this error message: Correct the errors below and try again. Your function's execution role must be assumable by the edgelambda.amazonaws.com service principal.
dagda1
  • 26,856
  • 59
  • 237
  • 450
47
votes
5 answers

Lambda@Edge not logging on cloudfront request

As explained in the Docs , I set up Lambda@edge for cloudfront trigger of Viewer Response. The lambda function code : 'use strict'; exports.handler = (event, context, callback) => { console.log('----EXECUTED------'); const response =…
41
votes
8 answers

Cannot delete AWS Lambda@Edge replicas

This question already exists here but I think it will have more impact on SO. I created an AWS Lambda@Edge function in order to rewrite Cloudfront URLs before they reach the Origin. AWS Lambda@Edge Function are automatically replicated through…
28
votes
6 answers

AWS Lambda@Edge Nodejs "Environment variables are not supported."

Motivation for doing this approach in the first place comes from Amazon: https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/ (before they added the 'update'...) In our AWS Lambda resize…
OZZIE
  • 6,609
  • 7
  • 55
  • 59
21
votes
1 answer

AWS Lambda@Edge not logging

I have viewer-request and origin-response Lambda functions deployed to a CloudFront distribution, which are firing, but not logging to CloudWatch. I have spent a considerable amount of time researching this topic, and have run through all advice…
15
votes
8 answers

Unable to add cloudfront as trigger to lambda function

Hi I've followed this instruction try to resize image with Cloudfront and lambda@edge. When I tried to test the resized image, I keep getting the error message below: The Lambda function associated with the CloudFront distribution is invalid or…
14
votes
3 answers

Why Lambda@Edge has to be in us-east-1 region?

I am trying to create a CloudFormation stack in us-east-2 (Ohio) region. However, getting the following error com.amazonaws.services.cloudfront.model.InvalidLambdaFunctionAssociationException: The function must be in region 'us-east-1' I have gone…
cmxiv 914
  • 610
  • 6
  • 10
11
votes
3 answers

Where to find the logs for Lambda@Edge?

As one of the steps for the previous problem I've faced, I need to see the logs for some Lambda@Edge but I cannot find them anywhere. According to the documentation on Lambda@Edge: When you review CloudWatch log files or metrics when you're …
Mehran
  • 15,593
  • 27
  • 122
  • 221
11
votes
2 answers

AWS Lambda@Edge debugging

I'm currently working on a lambda@edge function. I cannot find any logs on CloudWatch or other debugging options. When running the lambda using the "Test" button, the logs are written to CloudWatch. When the lambda function is triggered by a…
10
votes
3 answers

Lambda@Edge function not being called on Cloudfront error page

I have an Angular app's static files being served on an S3 bucket through Cloudfront. My Cloudfront distribution has error pages set up so it still renders the Angular's index.html. This means that if I request…
10
votes
2 answers

accessing origin URL from AWS lambda@edge

I'm trying to implement a "proxy" to multiple websites using lambda@edge on AWS Cloudfront. My setup is roughly: DNS: *.domain.com -> some_uuid.cloudfront.net (Cloudfront distribution) Cloudfront: some_uuid.cloudfront.net -> s3 bucket origin s3…
9
votes
1 answer

Serverless: Fire and forget by invoke method does not work as expected

I have a Serverless lambda function, in which I want to fire(invoke) a method and forget about it I'm doing it with this way // myFunction1 const params = { FunctionName: "myLambdaPath-myFunction2", InvocationType: "Event", …
9
votes
1 answer

AWS Lambda@edge. How to read HTML file from S3 and put content in response body

Specifically, in an origin response triggered function (EX. With 404 Status), how can I read an HTML file stored in S3 and use its content for the response body? (I would like to manually return a custom error page just as CloudFront does, but…
7
votes
2 answers

How to select the correct region with Dynamodb Global Tables and Lambda@edge?

I have created a Lambda function which retrieves some data from DynamoDB, and it'll output some JSON. What I'm trying to do is run this function in lambda@edge and generate a response which I can cache using Cloudfront. The problem I'm facing is…
Ben Swinburne
  • 25,669
  • 10
  • 69
  • 108
7
votes
3 answers

Cloudfront Lambda@edge set cookie on Viewer Request

Update: Collected my thoughts better I'm generating a unique identifier (UUID) for each user in the Viewer Request Lambda, and then selecting a cached page to return based upon that UUID. This works. Ideally, this user would always have the same…
1
2 3
17 18