awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Audio-only setup w/ modified trigger Lambda does not appear to work at all #240

Closed armenr closed 3 years ago

armenr commented 3 years ago

Description & Context

Following what's outlined here: https://github.com/awslabs/amplify-video/wiki/audio Have also read/followed the instructions here: https://github.com/awslabs/amplify-video/issues/121#issuecomment-782283033

To Reproduce Steps to reproduce the behavior:

  1. amplify add video to existing project
  2. Selected VoD, production true, signed urls yes, API yes, access granted to any authenticated user
    ╰─ amplify video add
    ? Please select from one of the below mentioned services: Video-On-Demand
    ? Provide a friendly name for your resource to be used as a label for this category in the project: audiostreams
    ? Select a system-provided encoding template, specify an already-created template name:  Default HLS Adaptive Bitrate
    ? Is this a production enviroment? Yes
    ? Do you want to protect your content with signed urls? Yes
    ? Do you want Amplify to create a new GraphQL API to manage your videos? (Beta) Yes
    Using app3 to manage API
    ? Define your permission schema Any authenticated user can upload videos
    ? Do you want to override your GraphQL schema? No
    ? Do you want to edit your newly created model? No
  3. amplify push
  4. Followed Wiki (Audio streams) instructions for creating job template
  5. Modified mediaconvert-job-temp.json as per the wiki
  6. add "postfix" for mp3 + FLAC file extensions:
    • created amplify/backend/video/audiostreams/custom/vod-helpers/LambdaFunctions/SetupTriggerLambda/index.js
    • saw the code successfully build and zip in the "custom" directory & saw change to code reflected in the Lambda Console (manually inspected the index.js for the trigger function).
  7. Deploy
  8. Upload .FLAC or .MP3 to my input bucket --> no jobs triggered, lambda does not appear to run

Other problems:

  1. I have seen the following in my CloudWatch logs (note the "Cfn Status: undefined") Screen Shot 2021-04-18 at 12 17 34 PM

Expected behavior Expect to upload .FLAC or .MP3 files to S3 bucket and see the Lambda get triggered + media convert job created

Screenshots

Desktop (please complete the following information):

armenr commented 3 years ago

Update

Same situation/case when I do this from a totally new/"from scratch" deployment --> amplify init, amplify add auth, amplify add api, amplify push, amplify add video, amplify push --> then modify job template, then modify custom trigger lambda

Same outcome/behavior

armenr commented 3 years ago

Tried deploying to a fresh app/environment in a different region (us-east-1). Same problem.

I am able to update my media job template. I am able to adjust the file extension postfix for MP3 + FLAC and build/deploy that to lambda successfully (using "custom" directory).

When I upload files to the input S3 bucket through the S3 console (flac file, mp3 file), no lambdas appear to get triggered/no jobs are submitted/created.

wizage commented 3 years ago

Hey @armenr

This is a great issue, something we want to do is add more "valid" triggers for Amplify Video. (Like mov, mp3, flac, aac, avi)

The current problem is in the lambda function itself and they way S3 triggers work. Today the trigger only works on Stack Create. https://github.com/awslabs/amplify-video/blob/master/provider-utils/awscloudformation/cloudformation-templates/vod-helpers/LambdaFunctions/SetupTriggerLambda/index.js#L16

I need to add the triggers to be called on Update Stack, to allow this to happen if the stack changes. This will take a little but I think this def needs to be updated!

In the mean time if you need to move fast you can manually add the triggers to the S3 bucket and you are good to go. Future pushes won't impact this!