SavageCore / node-ffprobe-installer

Platform independent binary installer of FFprobe for node projects
https://www.npmjs.com/package/@ffprobe-installer/ffprobe
73 stars 29 forks source link

ffprobe EACCES after deploying lamda function #249

Closed oluSammy closed 1 year ago

oluSammy commented 1 year ago

Hi, I get this error after deploying my function to aws lamda. it works well locally { "errorType": "Error", "errorMessage": "spawn /var/task/node_modules/@ffprobe-installer/linux-arm64/ffprobe EACCES", "trace": [ "Error: spawn /var/task/node_modules/@ffprobe-installer/linux-arm64/ffprobe EACCES", " at ChildProcess._handle.onexit (node:internal/child_process:283:19)", " at onErrorNT (node:internal/child_process:476:16)", " at process.processTicksAndRejections (node:internal/process/task_queues:82:21)" ] }

this is my code

`const ffprobePath = require('@ffprobe-installer/ffprobe').path;

ffmpeg.setFfprobePath(ffprobePath);`

Thanks

hakimscode commented 1 year ago

I also face same issue here, I'm using lambda with ECR docker image

I have added .npmrc but still get the same error

2023-03-28T10:03:54.406Z    f6713d3f-52da-499a-8862-5c48f7f9eab8    INFO    Error: spawn /var/task/node_modules/@ffprobe-installer/linux-x64/ffprobe EACCES
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:485:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -13,
  code: 'EACCES',
  syscall: 'spawn /var/task/node_modules/@ffprobe-installer/linux-x64/ffprobe',
  path: '/var/task/node_modules/@ffprobe-installer/linux-x64/ffprobe',
  spawnargs: [
    '-show_streams',
    '-show_format',
  ]
}
oluSammy commented 1 year ago

I solved the issue this way


const ffprobeSrcPath = require("@ffprobe-installer/ffprobe").path;

const ffprobeDestPath = "/tmp/ffprobe";

// Copy the ffprobe executable to the /tmp directory
fs.copyFileSync(ffprobeSrcPath, ffprobeDestPath);

// Set the permissions of the ffprobe executable to 777
fs.chmodSync(ffprobeDestPath, "777");

// Set the path of the ffprobe and ffmpeg executable
ffmpeg.setFfprobePath(ffprobeDestPath);
ffmpeg.setFfmpegPath(ffmpegs as string);```
hakimscode commented 1 year ago

It works, thank you @oluSammy

But I wonder why you should copy the ffprobe executable file to /tmp?