aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.82k stars 821 forks source link

AWS Amplify and Lambda@Edge #4939

Open fomson opened 4 years ago

fomson commented 4 years ago

Which Category is your question related to? Hosting, Lambda Amplify CLI Version 4.24.3+

Can I add Lambda@Edge to my AWS Amplify app?

fomson commented 4 years ago

https://github.com/aws-amplify/amplify-console/issues/412

ammarkarachi commented 4 years ago

@FOMSON Thanks for the feature request we will take a look into. Any feedback on how you would like to use and create Lambda@Edge in Amplify CLI would be useful too

fomson commented 4 years ago

@ammarkarachi Thank you for coming back to me.

Could this be implemented as part of amplify hosting update? Allow linking functions to different trigger events available with a standard CloudFront distribution? Perhaps, to meet Lambda@Edge limits and requirements, such functions should be created as part of amplify hosting update (or when amplify hosting add), and not by amplify function add?

May I ask how feasible this feature is to wait for? Otherwise, I will proceed with a workaround by using the S3 and CloudFront hosting option.

kylekirkby commented 4 years ago

@ammarkarachi - it would be great if lambda@edge functions were supported by the CLI. I'm in need of this support for SSR rendering static pages for SEO purposes. I noticed that most of the work to support this via the JS SDK has been kindly done by @ericclemmons. I've yet to see the status on actually deploying the infrastructure to support SSR, however.

WillDelish commented 4 years ago

I to would love this feature :)

ccortezb commented 3 years ago

im really need this feature in amplify.

amplify add function ? Select which capability you want to add:

Lambda Edge (Associated with Cloudfront). <--- new option

thanks

jdw88 commented 3 years ago

im really need this feature in amplify.

amplify add function ? Select which capability you want to add:

Lambda Edge (Associated with Cloudfront). <--- new option

thanks

This would be a very useful feature. I have a Lambda function managed via Amplify and require a new numbered version for a CloudFront trigger. This process is managed outside of Amplify and is very cumbersome.

kylekirkby commented 3 years ago

It's currently recommended to use the serverless/next-js component.

https://docs.amplify.aws/start/getting-started/hosting/q/integration/next

I've used this component and it works well. I hope the Amplify team can eventually add this functionality to the CLI, although quite a bit of work would be required. Maybe an amplify plugin should be created to seamlessly integrate Serverless Framework stacks into the Amplify CLI.

cornelcroi commented 3 years ago

Hi,

It would be very useful to add lambda@edge for the CloudFront hosting distribution. I thing the easier would be to implement it on amplify hosting add or amplify hosting update when it will ask you if you need a lambda edge. If so, you should let you choose which trigger you want (viewer request, origin request, origin response and viewer response) with a multiple selection option.

vincent38wargnier commented 3 years ago

Is there any update on a tool through amplify console to save our SEO?

greenafrican commented 2 years ago

We're having to move our Amplify app to S3 so we can add a viewer request Lambda@Edge function to populate social open graph cards, unfurls etc. Would really LOVE to be able to use Amplify and add these functions to the app's seemingly hidden CloudFront distribution.

Tony-OAA commented 2 years ago

Hi AWS people,

Can you provide any guidance on this please.?

We are also trying to use prerender.io to take care of serving statics pages to crawlers and bots. Their service loads and runs SPAs and caches the pages just like your client browser. These can then be quickly returned to crawlers that don't have to handle a full React SPA. This trick requires that the crawler is detected and the returned page comes from the prerender.io cache and not just the SPA loading.

Prerender.io support points to a github repo that uses lambda@edge functions to do this. But how do I associate these with our Amplify domain?

https://github.com/jinty/prerender-cloudfront

I have used other SPA hosting Meteor Galaxy, that just has a checkbox in the admin UI to enable/disable. This is something you could also add into Amplify Console - this would save a lot of SEO headaches

help appreciated Thanks

chrisninetyone commented 1 year ago

Any update on this in 2023? I am also trying to serve up some HTML to crawlers and bots.

vcrego commented 1 year ago

+1 Really in need of lambda@edge in amplify application, make lot work easier.

With edge can set function, which transforms the incoming POST request to a GET request and passes the required payload parameter in the query string. Not finding this easy in amplify.

electronicalias commented 10 months ago

+1

Need it for AWS Marketplace integration using transformation of POST to GET with url params etc.