question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow overriding of lambda@edge origin-request for custom paths

See original GitHub issue

Is your feature request related to a problem? Please describe. I have a custom path on my NextJS app that I want to route through a custom Lambda@Edge function of my own, but this code overrides it even if I provide it in the input configuration.

Describe the solution you’d like Allow the override to happen, I don’t think it makes sense to have a configuration that gets overridden always.

Describe alternatives you’ve considered Since I can’t do this override I have to manually edit the default-lambda code using a custom script on the build.postBuildCommands.

Additional context

nextApp:
  component: '@sls-next/serverless-component@1.19.0-alpha.30'
  inputs:
    cloudfront:
      /custom-route/*:
        viewerProtocolPolicy: 'redirect-to-https'
        allowedHttpMethods:
          ['GET', 'HEAD', 'OPTIONS', 'PUT', 'POST', 'PATCH', 'DELETE']
        minTTL: 0
        maxTTL: 31536000
        defaultTTL: 0
        forward:
          cookies: 'all'
          queryString: true
        compress: true
        lambda@edge:
          origin-request: THIS_GETS_OVERRIDEN_WITH_THE_DEFAULT_LAMBDA_ARN

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ivan-mosiev-altexsoftcommented, Feb 4, 2022

Any updates on this or maybe some workaround?

0reactions
dphangcommented, Feb 22, 2022

@mattvb91 yes I think as mentioned in the OP, https://github.com/serverless-nextjs/serverless-next.js/blob/828b9dde89a9cb2559c58ab4e798ee7cbcbdd5e6/packages/serverless-components/nextjs-component/src/component.ts#L647 as mentioned is the code that sets up the CloudFront configuration. Or you can try to use the CDK deployer as it might provide more flexibility

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambda@Edge example functions - Amazon CloudFront
This function demonstrates how an origin-request trigger can be used to change from a custom origin to an Amazon S3 origin from which...
Read more >
Request and response behavior for custom origins
This topic contains information about how CloudFront processes viewer requests and forwards the requests to your custom origin.
Read more >
How to use CloudFront Functions to change the origin request ...
Unless you want to change the origins, which is not a good solution, you need to fix the origin request path. A Lambda...
Read more >
REST API (API Gateway v1) - Serverless Framework
HTTP Endpoints with Custom Authorizers. Custom Authorizers allow you to run an AWS Lambda Function before your targeted AWS Lambda Function. This is...
Read more >
Lambda@Edge fallback to custom origin from s3 with ...
request.origin = { custom: { domainName: 'www.example.com', port: 443, protocol: 'https', path: '', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found