trackit / aws-workflow-video-on-demand

AWS Workflow for video-on-demand with automated API
Apache License 2.0
62 stars 19 forks source link

vod-workflow-dev-get_videos #7

Open slattouf95 opened 4 years ago

slattouf95 commented 4 years ago

Hi,

Thank you for the robust workflow setup. All of curl methods are working properly except get video by id, returns an internal server error. I have checked the API gateway error and apparently the get video by id throws an Execution failed due to configuration error: Malformed Lambda proxy response. My guess is that it has to do with the format of my Lambda function's response to the API. I'd highly appreciate it if you have any tips.

Thanks!

slattouf95 commented 4 years ago

After further debugging I have notived that the API get_video by id only throws an error when the transcoding status is "Ready" so the failure is caused from the conditional if the item is "Ready" `

    if item['status'] == "Ready":
          content = {}
          content['mp4'] = generate_cf_presigned_url(vid + '/' + vid + '.mp4')
          content['thumbnails'] = []
          response = s3.list_objects(
              Bucket=get_config("videos", "outputBucket"),
              Prefix=vid + '/thumbnails'
          )
          for object in response['Contents']:
              content['thumbnails'].append(generate_cf_presigned_url(object['Key']))
          content['hls'] = {}
          response = s3.list_objects(
              Bucket=get_config("videos", "outputBucket"),
              Prefix=vid + '/hls1'
          )
          for object in response['Contents']:
              if object['Key'].endswith(".m3u8"):
                  filename = object['Key'].split('/')[-1]
                  if filename.startswith("master_"):
                      content['hls'][filename] = generate_cf_presigned_url(object['Key'])
          item['content'] = content`
pierrejoye commented 4 years ago

Some method names changed since then (or bug ;)

On https://github.com/trackit/aws-workflow-video-on-demand/blob/master/misc.py#L71

Change: if "generate_cloudfront_presigned_urls" in func['FunctionName']: to if "generate_presigned_urls" in func['FunctionName']: