awslabs / live-streaming-with-automated-multi-language-subtitling

Live Streaming with Automated Multi-Language Subtitling is a project to automatically generates multi-language subtitles for live streaming web video content. Adding subtitles to your live video content can help improve reach and access, exposing your content to a much larger audience.
Apache License 2.0
160 stars 96 forks source link

Error while deploying stack - Lambda@Edge cannot retrieve the specified Lambda function #33

Closed innomanik closed 3 years ago

innomanik commented 3 years ago

Hi, I am getting the below error while deploying the stack, any help/guidance would be highly appreciated.

Untitled

Lambda@Edge cannot retrieve the specified Lambda function. Update the IAM policy to add permission: lambda:GetFunction for resource:

Also please confirm that the below line no 207 in the deployment/live-streaming-with-automated-multi-language-subtitling.template

KeyPrefix: live-streaming-with-automated-multi-language-subtitling/%%VERSION%%

Should be - KeyPrefix: %%SOLUTION_NAME%%/%%VERSION%%

innomanik commented 3 years ago

I am still stuck on this one, tried many things but can't get pass through it. Any help would highly appreciated.

eggoynes commented 3 years ago

Hi there. Are you using the Launch Stack link in the ReadMe file? Which region are you deploying in? image

innomanik commented 3 years ago

Hi Eddie, thanks for the response, I am not launching the stack using the link from the ReadMe file, I have cloned the project and trying to launch the stack using the template ("global-s3-assets/live-streaming-with-automated-multi-language-subtitling.template") file which gets generated after running the "build-s3-dist.sh" file. I am trying to launch the stack in US East (N. Virginia) region.

I haven't made any changes to code or any script yet but I wanted to do this way so that I can make changes after this gets deployed and running for the first time. Please let me know if you need any more details to get me pass this issue. Again thank you so much for the help.

I have attached the generated template file below (file extension changed to .txt) -

live-streaming-with-automated-multi-language-subtitling.txt

innomanik commented 3 years ago

Hi Eddie, Today I tried running the stack using the "Launch Stack" link in the ReadMe file but the error is still the same. I am looking forward to hear from your side. I tried creating a technical support request in AWS console for this issue but seems like they are also not able to find the issue and help me move forward.

taschmidt commented 3 years ago

@innomanik why was this closed? Did you figure out the issue? Because I'm running into the same problem.

innomanik commented 3 years ago

@taschmidt I closed this issue, because once I rebuilt the solution by executing this file - "build-s3-dist.sh" again, the error was gone. I had downloaded the release zip again, earlier I had cloned the repository and used "master" branch which had this issue, then I downloaded the release 2.0 zip which worked. You should also check if you are using master branch or the release build. https://github.com/awslabs/live-streaming-with-automated-multi-language-subtitling/releases/tag/v2.0.0

One more thing - make sure you are not repeating the same stack name while deploying the stack, lambda@edge instance gets removed automatically when it doesn't has any reference from CloudFront but it takes some time (I don't know how much). I found out if I use the same stack name after a day it works fine.

taschmidt commented 3 years ago

Thanks @innomanik, my problem ended up being lambda versioning. Even when the stack creation failed, the lambda@edge function version kept increasing but the template has it hard-coded to version #1.

I fixed it by changing the lambda@edge creation code return the version number too. @EddieGoynesAmazon you might want to think about adding this to the template. https://github.com/awslabs/live-streaming-with-automated-multi-language-subtitling/compare/awslabs:f5916b7...taschmidt:fa1d4ac

eggoynes commented 3 years ago

@taschmidt Innomanik is correct that if you use the same stack name twice you will have to wait "a few hours" before the Lambda@Edge replicas are deleted.

This quirk of Lambda@Edge is documented here. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-delete-replicas.html Replicas are typically deleted within a few hours. You cannot manually delete Lambda@Edge function replicas.

I will merge the V2.0.0 branch with master. Additionally if you add the change you suggest in a pull request I can approve it for you! Thanks!

taschmidt commented 3 years ago

Submitted a PR. @EddieGoynesAmazon why am I not seeing the 2.0.0 branch? What are the highlights?