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
3
votes
3 answers

Cannot read property '0' of undefined at exports.handler (/var/task/index.js:4:34)

I have created a Lambda Function when I try to execute the function throw error 'use strict'; exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; const headers = request.headers; const origin =…
midun
  • 31
  • 1
  • 2
3
votes
1 answer

How to fix Access Denied error while resizing images with lambda@edge

I am trying to use Lambda@Edge functions in the article below on an already existing s3 bucket and its distribution: https://aws.amazon.com/blogs/networking-and-content-delivery/resizing-images-with-amazon-cloudfront-lambdaedge-aws-cdn-blog/ I can…
3
votes
2 answers

How to add add custom header in Cloudfront Lambda@Edge Origin Request?

I have a Cloudfront distribution with a custom origin. I want to use a Lambda@Edge Origin Request to modify and add some extra headers to be forwarded to my origin server. Below is my Lambda function. The custom_header is visible in Cloudwatch logs…
3
votes
2 answers

lambda@edge logs and invocation counts are not showing?

I have created the cloud front distribution and attached the lambda with the trigger `Event type: viewer-requestPath pattern: something/index.html` Event type: origin-requestPath pattern: something/index.html When i hit the endpoint it's…
2
votes
1 answer

How to return HTML code from Lambda function in NodeJS?

I have the following Lambda function. I need to return some custom html when the function is called. I tried: exports.handler = async (event, context, callback) => { const response = { statusCode: 200, headers:…
Thomas Carlton
  • 5,344
  • 10
  • 63
  • 126
2
votes
1 answer

Reading AWS Param Store from Lambda

First foray into AWS's Lambda@Edge and trying to retrieve secrets from AWS Param Store for authentication (following this article) but getting nothing back. Here's the function that calls the AWS.SSM function: const fromParameterStore =…
Capn Sparrow
  • 2,030
  • 2
  • 15
  • 32
2
votes
1 answer

Can Cloudfront be configured to scrub all IP addresses from the incoming request before passing to the origin?

For compliance reasons, we are not able to collect or process IP addresses in our application. With an initial look, it seems that the new(ish) Cloudfront Functions might be able to do what is needed.…
Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
2
votes
2 answers

Cannot delete Lambda@Edge created by Cloud Formation

I cannot delete a Lambda@Edge function create by Cloud Formation. During the Cloud Formation creation process an error occurred and the rollback process was executed. At the end we can't remove the Lambda created, we resolved the CF problem, renamed…
2
votes
0 answers

How can I aggregate cloudwatch logs for Lambda-edge automatically?

For a Lambda Edge a CloudWatch Log Group is created in a region where endpoint was requested. I'd like to gather all the logs, including these which will appear in the regions, which are not activated yet. I know how to do it manually (go to each…
Max Kurtz
  • 448
  • 5
  • 17
2
votes
2 answers

Return image from aws lambda function

Hey guys I'm trying to return an image as an http response from aws lambda/api-gateway. For some reason my response ends up with an empty image. Here's what I have on aws lambda: "use strict"; var handler = function (event, context, callback)…
2
votes
0 answers

missing logs in aws cloudwatch lambda insights

I've enabled "Enhanced monitoring" and assign CloudWatchLambdaInsightsExecutionRolePolicy to all my functions, but can't see any info in CloudWatch lambda insights. It just tells me that I didn't enable this feature image. Could someone please point…
2
votes
0 answers

Serverless Authentication: Auth0 at Lambda@Edge triggered by Cloudfront Viewer request protecting S3 Bucket. Infinity Redirect loop

Context I have a S3 bucket with static files. In front of this bucket, i have Cloudfront, triggering a lambda@edge function on each viewer request. My lambda function is based on this following project: https://github.com/Widen/cloudfront-auth What…
2
votes
1 answer

How can I force origin request inside Lambda@Edge Viewer Request event if URL contains certain query parameter

I have a CloudFront cache behaviour configured to cache all pages under the path pattern /posts. The cache behavior is fetching the content from custom origin which is a WordPress website. I need to implement custom caching logic based on the…
2
votes
2 answers

What happens when an AWS Lambda times out?

I understand that when a Lambda times-out, it returns an error. Once the Lambda times-out, though, I'd like to know if it's immediately killed by AWS, or if it can potentially continue running for an arbitrary amount of time in the background…
Lawrence Wagerfield
  • 6,471
  • 5
  • 42
  • 84
2
votes
1 answer

Deploy to lambda edge function from aws cli

I am in the process of automating our deploy for a Lambda Edge function using Octopus Deploy I have added a step to deploy the latest js code to the function, and clear the cloudfront cache, which work great. The issue I have is I need to use an aws…