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.
When I upload a video to the input bucket, it triggers video conversion, but fails to complete the InputTriggerLambdaFunction.
To Reproduce
Steps to reproduce the behavior:
Add amplify-video to an existing application, configuring it to Video-On-Demand. Example as follows.
$ npm i amplify-category-video -g
$ amplify plugin add
$ amplify video add
? 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: xamavod
? Select a system-provided encoding template, specify an already-created template name: Default HLS Adaptive Bitrate
? Do you want to get notifications on the video processing job? Yes
? Do you want a custom function executed for notifications? Yes
? 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) No
✔ All resources built.
$ amplify push
Upload a video file (extension .mp4) to the generated S3 input bucket.
Open the AWS Elemental MediaConvert console, select Jobs. Result: No job is submitted for processing.
Open the CloudWatch console, filter inputwatcher to find the log group of the corresponding rInputLambdaTriggerFunction Lambda Function.
Open the log. Result is an error like the following.
{
"errorType": "AccessDeniedException",
"errorMessage": "User: arn:aws:sts::[xxxxx]:assumed-role/[xxxxx]-videox-LambdaExecutionRole-[xxxxx]/[xxxxx]-inputWatcher is not authorized to perform: mediaconvert:TagResource on resource: arn:aws:mediaconvert:us-east-1:[xxxxx]:jobs/*",
"code": "AccessDeniedException",
"stack": [
"AccessDeniedException: User: arn:aws:sts::[xxxxx]:assumed-role/amplify-[xxxxx]-videox-LambdaExecutionRole-[xxxxx]/[xxxxx]-inputWatcher is not authorized to perform: mediaconvert:TagResource on resource: arn:aws:mediaconvert:us-east-1:[xxxxx]:jobs/*",
" at Object.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/json.js:52:27)",
" at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/rest_json.js:49:8)",
" at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
" at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:686:14)",
" at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)",
" at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)",
" at /var/runtime/node_modules/aws-sdk/lib/state_machine.js:26:10",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:38:9)",
" at Request.<anonymous> (/var/runtime/node_modules/aws-sdk/lib/request.js:688:12)"
]
}
Expected behavior
Job submitted to Media Convert and after processed, the output files generated in the S3 output bucket.
Desktop (please complete the following information):
OS: macOS Version 11.6.1
Browser: Safari
Version: amplify-video v3.9.1
Proposed solution
I solved the issue with the following steps to make it work after deployed:
Opened IAM console and selected Roles.
Opened amplify-xama-dev-194301-videox-LambdaExecutionRole-7Q383P958FXF role (exact name is different for each deployed application).
Added the following Action to the MediaConvert resource in S3PolicyTesting policy:
Describe the bug
When I upload a video to the input bucket, it triggers video conversion, but fails to complete the
InputTriggerLambdaFunction
.To Reproduce
Steps to reproduce the behavior:
Upload a video file (extension .mp4) to the generated S3 input bucket.
Open the AWS Elemental MediaConvert console, select Jobs. Result: No job is submitted for processing.
Open the CloudWatch console, filter
inputwatcher
to find the log group of the correspondingrInputLambdaTriggerFunction
Lambda Function.Open the log. Result is an error like the following.
Expected behavior Job submitted to Media Convert and after processed, the output files generated in the S3 output bucket.
Desktop (please complete the following information):
Proposed solution
I solved the issue with the following steps to make it work after deployed:
amplify-xama-dev-194301-videox-LambdaExecutionRole-7Q383P958FXF
role (exact name is different for each deployed application).S3PolicyTesting
policy:Full S3PolicyTesting JSON file as follows:
Note: some specific parts of the policy were replaced by
[xxxxx]
.My suggestion is that this action should be added to the InputTriggerLambda.template file.
I can submit a PR if this is confirmed as a bug and the solution applies.