The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

arlend3 (2) [Avatar] Offline
#1
Good afternoon,

When I tried to run the metadata extraction function I got the following error for the transcoded projects and cannot for the life of me figure out why it occurred. Any thoughts?

2016-05-18T01:59:21.900Z 2209eb39-1c9c-11e6-9555-fb19d12be99e
{
"errorMessage": "Command failed: /bin/sh -c bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video1.mp4-1080p.mp4\"\n/bin/sh: bin/ffprobe: Permission denied\n",
"errorType": "Error",
"stackTrace": [
"/bin/sh: bin/ffprobe: Permission denied",
"",
"ChildProcess.exithandler (child_process.js:213:12)",
"emitTwo (events.js:87:13)",
"ChildProcess.emit (events.js:172:7)",
"maybeClose (internal/child_process.js:821:16)",
"Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
]
}

Thank you,
Arlen Duncan III
Peter Sbarski (18) [Avatar] Offline
#2
Hi Arlen, thank you for your question! Are you using Linux/Mac or Windows?

If you are on Linux/MacOX could you run chmod 775 on ffprobe and then re-upload the function again?
chmod 775 ffprobe


If you are using Windows modify cmd in the extractMetadata function. Change cmd to be the following:
var cmd = 'chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format "/tmp/' + localFilename + '"';


Please let me know if it works for you and if you are still getting errors.
arlend3 (2) [Avatar] Offline
#3
Hi,

I am running it from a Windows box. I made the change in extraction function and the function proceeded to error out with the following so that tells me that I need to modify the IAM policy in regards to S3 for the lambda-excute role. I am going to figure this out as this seems like a good project to get my feet in the world of serverless architecture.

 Filter: chmod
 Date/Time: 2016/06/01 01:34:57  
			
Creation Time
Event Data
Ingestion Time
2016-06-01 01:34:59 UTC
2016-06-01T01:34:59.358Z	0b417eab-2799-11e6-9017-dbe7ce5ec688	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:35:12 UTC
2016-06-01 01:34:59 UTC
2016-06-01T01:34:59.361Z	0b417eab-2799-11e6-9017-dbe7ce5ec688
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-720p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:35:12 UTC
2016-06-01 01:35:56 UTC
2016-06-01T01:35:56.358Z	0b417eab-2799-11e6-9017-dbe7ce5ec688	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:36:10 UTC
2016-06-01 01:35:56 UTC
2016-06-01T01:35:56.358Z	0b417eab-2799-11e6-9017-dbe7ce5ec688
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-720p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:36:10 UTC
2016-06-01 01:36:00 UTC
2016-06-01T01:36:00.018Z	0b409539-2799-11e6-bb2e-3f3e0feddc73	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:36:10 UTC
2016-06-01 01:36:00 UTC
2016-06-01T01:36:00.018Z	0b409539-2799-11e6-bb2e-3f3e0feddc73
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-web-720p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:36:10 UTC
2016-06-01 01:36:01 UTC
2016-06-01T01:36:01.038Z	0b3a52cd-2799-11e6-b0eb-333966a6aa46	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:36:10 UTC
2016-06-01 01:36:01 UTC
2016-06-01T01:36:01.039Z	0b3a52cd-2799-11e6-b0eb-333966a6aa46
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-1080p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:36:10 UTC
2016-06-01 01:37:56 UTC
2016-06-01T01:37:56.758Z	0b409539-2799-11e6-bb2e-3f3e0feddc73	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:38:11 UTC
2016-06-01 01:37:56 UTC
2016-06-01T01:37:56.758Z	0b409539-2799-11e6-bb2e-3f3e0feddc73
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-web-720p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:38:11 UTC
2016-06-01 01:38:09 UTC
2016-06-01T01:38:09.978Z	0b417eab-2799-11e6-9017-dbe7ce5ec688	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:38:11 UTC
2016-06-01 01:38:09 UTC
2016-06-01T01:38:09.978Z	0b417eab-2799-11e6-9017-dbe7ce5ec688
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-720p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:38:11 UTC
2016-06-01 01:38:14 UTC
2016-06-01T01:38:14.818Z	0b3a52cd-2799-11e6-b0eb-333966a6aa46	chmod: changing permissions of 'bin/ffprobe': Operation not permitted  
2016-06-01 01:38:29 UTC
2016-06-01 01:38:14 UTC
2016-06-01T01:38:14.820Z	0b3a52cd-2799-11e6-b0eb-333966a6aa46
{
    "errorMessage": "Command failed: /bin/sh -c chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format \"/tmp/video2.mp4-1080p.mp4\"\nchmod: changing permissions of 'bin/ffprobe': Operation not permitted\n",
    "errorType": "Error",
    "stackTrace": [
        "chmod: changing permissions of 'bin/ffprobe': Operation not permitted",
        "",
        "ChildProcess.exithandler (child_process.js:213:12)",
        "emitTwo (events.js:87:13)",
        "ChildProcess.emit (events.js:172:7)",
        "maybeClose (internal/child_process.js:821:16)",
        "Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)"
    ]
}
2016-06-01 01:38:29 UTC


The policy I created to attach to the lambda-s3-execution-role. I am fairly certain when I test this later it will not help with the chmod error.
Summary
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetObject",
                "s3:PutObject"
            ],
            "Resource": "arn:aws:lambda:us-east-1:236314643822:function:extract-metadata"
        }
    ]
}


Thank you,
Arlen
472618 (13) [Avatar] Offline
#4
Peter Sbarski wrote:Hi Arlen, thank you for your question! Are you using Linux/Mac or Windows?

If you are on Linux/MacOX could you run chmod 775 on ffprobe and then re-upload the function again?
chmod 775 ffprobe


If you are using Windows modify cmd in the extractMetadata function. Change cmd to be the following:
var cmd = 'chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format "/tmp/' + localFilename + '"';


Please let me know if it works for you and if you are still getting errors.


I like the effort of chmod inside lambda, but that doesnt work, only /tmp is writable in lambda. perhaps the ffprobe could be moved there and chmod would then work. I got it to work by setting up an ec2 instance to create the zip file on and upload from.
A missing step is to add permissions needed to be added to the lambda function to read from and write to the transcoded directory
472618 (13) [Avatar] Offline
#5

i tested it and changing the lambda function command to this works from windows
var cmd = 'cp bin/ffprobe /tmp/ && chmod 775 /tmp/ffprobe && /tmp/ffprobe -v quiet -print_format json -show_format "/tmp/' + localFilename + '"';

472618 wrote:
Peter Sbarski wrote:Hi Arlen, thank you for your question! Are you using Linux/Mac or Windows?

If you are on Linux/MacOX could you run chmod 775 on ffprobe and then re-upload the function again?
chmod 775 ffprobe


If you are using Windows modify cmd in the extractMetadata function. Change cmd to be the following:
var cmd = 'chmod 775 bin/ffprobe && bin/ffprobe -v quiet -print_format json -show_format "/tmp/' + localFilename + '"';


Please let me know if it works for you and if you are still getting errors.