Description
I'm trying to run a third-party exe called MediaInfo through a lambda function written in .NET Core 2.0. There's a good example of this (from about 2 years ago, and written in Python) here:
https://aws.amazon.com/blogs/compute/extracting-video-metadata-using-lambda-and-mediainfo/
I've built the MediaInfo code as instructed and included it in my project. I can see the resulting binary is included in my published .zip file. I've also verified that the same binary runs when invoked from a Node.js lambda function. However, when attempting to run it from my .NET lambda function, I get the following exception:
Exception: System.ComponentModel.Win32Exception (0x80004005): Permission denied
at Interop.Sys.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Int32& lpChildPid, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at MediaInfoTest.Function.FunctionHandler(String input, ILambdaContext context) in C:\\Dev\\Research\\MediaInfoTest\\MediaInfoTest\\Function.cs:line 40
After doing some research, I found some Node.js examples where they had similar permission problems, and one of the suggested fixes was to add the following:
process.env["PATH"] = process.env["PATH"] + ":" + process.env["LAMBDA_TASK_ROOT"];
I believe I've done the .NET equivalent with the following line:
Environment.SetEnvironmentVariable("PATH",
$"{Environment.GetEnvironmentVariable("PATH")}:{Environment.GetEnvironmentVariable("LAMBDA_TASK_ROOT")}");
I've verified once this is done that the LAMBDA_TASK_ROOT path has been added to the PATH variable, but unfortunately this didn't seem to make a difference.
I've provided a sample project that reproduces the issue here:
https://github.com/evanverneyfink/MediaInfoTest
Any ideas on what I might be doing wrong? Would this be considered a bug, or is this not yet expected to work with .NET Core?