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
1
vote
0 answers

Logging RequestId in from Lambda@Edge in CloudWatch

I am working on a set of Lambda@Edge and trying to setup some audit logging. When the events end up in CloudWatch, I can see the START and END events are logging a RequestId, which appears to be a UUID. In the event I receive in the Lambda code,…
CodeChimp
  • 8,016
  • 5
  • 41
  • 79
1
vote
1 answer

Modify Cloudfront origin response with Lambda - read-only headers

I have a Cloudfront distribution with a single React site, which is hosting in S3. The origin is connected via REST api. To properly handle queries, I use custom error responses on status 403 and 404 to 200 and route them to root. The root object is…
1
vote
0 answers

Vue JS and vite-plugin-ssr for Server or Client Side Rendering, depending on the user-agent, ideally to be hosted on AWS Lambda Edge

I'm trying to use vite-plugin-ssr with VueJS, and dynamically decide whether to SSR or serve the Vue code for client rendering, according to the User-Agent passed to isbot (https://github.com/omrilotan/isbot). The strategy is : If isbot() returns…
Marc
  • 31
  • 3
1
vote
1 answer

LambdaEdge viewer cannot access CloudFront HTTP header CloudFront-Viewer-Country

I am trying to access the CloudFront HTTP Header CloudFront-Viewer-Country from a LambdaEdge Viewer function. However, despite adding said header as a cache key in the CloudFront Cache Policy, and seeing this header appear in my Origin logs, I am…
ste26054
  • 419
  • 3
  • 11
1
vote
1 answer

Cannot read properties of undefined (reading 'startsWith') error while deploying lambda edge function

In AWS I am configuring CloudFront with S3 Origin. The S3 is configured for Server-Side Encryption with Customer Master Keys (CMKs). Because of the coudfront issue with S3 with CMK encryption, we have to use Lambda@Edge function as suggested in…
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

Cloudfront as a reverse proxy for backend

I have tried to put in place a CloudFront distribution that would forward requests using a CloudFront function to our external API GW (not the AWS one). However this creates an issue with CORS. I can make the CORS request working, however what I am…
Astronaut
  • 6,691
  • 18
  • 61
  • 99
1
vote
1 answer

Hash a custom ETag in Lambda

I have a custom Origin that doesn't provide ETags. I'm using Lambda@Edge to insert a custom ETag response header using Javascript into my Cloudfront distribution. exports.handler = async (event, context) => { const response = { status:…
1
vote
1 answer

Performance and Cost Comparison of Lambda@Edge vs Lambda as Cloudfront Origin

I'm creating a service where a client needs to get some data stored in a DynamoDB table. I'm using Cloudfront as a CDN for reducing latency. I have 2 methods of obtaining the data from the DynamoDB table. Method 1: The client sends a request to…
1
vote
0 answers

Set-Cookie using CloudFront, Lambda@edge and S3 doesn't work on local

I have created a CloudFront CDN that points to a file in S3 and triggers a Lambda@Edge. For Lambda@Edge, I have followed this article to return the Set-Cookie…
1
vote
0 answers

lambda@edge fails when rewritten uri contains space

We have a lambda@edge function which takes an "obfustated" uri path and rewrites it to the correct path before the request is forwarded to s3. Whenever the s3 object contains a space, the request fails with a 502 and we can see this in the…
Trondh
  • 3,221
  • 1
  • 25
  • 34
1
vote
0 answers

How to restrict content using AWS lambda edge

I'm fairly new to the whole AWS environment, about 1 month into learning and it is definitely a lot to take in but at the same time it is amazing. I'm working from some project examples. This one I'm on uses a NextJS boilerplate and has its content…
1
vote
1 answer

AWS Amplify did not create Lambda@Edge replica in all regions

I have an AWS Amplify project (with Next.js), which works fine. Nevertheless, most of my users are close to Paris (region eu-west-3), but Cloudfront and Lambda@Edge did not deploy any replicas in this region, but in many other regions, like London…
Vincent J
  • 4,968
  • 4
  • 40
  • 50
1
vote
1 answer

AWS Lambda@Edge 502 LambdaValidationError in CloudFront for redirect

I have a lambda function which performs 301 redirect if it has uri that is generated using regex. const redirects = { xyz: '/contact', abc: '/about', }; const arrRegex = [ { regex: /\xyz/\faq/\max, redirect: redirects.xyz }, {…
1
vote
0 answers

Signed cookies using lambda@edge

I'm using a lambda@edge, viewer request to include signed cookies in my application, but for some reason the cookies are not set in the headers, I followed the example of this documentation…
1
vote
1 answer

Simplest way to host a static webpage in AWS with a single case-sensitive response header

I'm trying to create a simple webpage for a ConnMan connectivity check from some embedded devices. This library is very finicky about certain things. The body must be: \n\n\n\n\n\n If anything, even the…