-
Notifications
You must be signed in to change notification settings - Fork 488
"Permission denied" Win32Exception when using Process.Start #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The mediainfo file doesn't have execute permission. To complicate matters, files under /var/task are read-only. So instead of setting the environment variable do this before starting your process:
and change StartInfo.Filename to "/tmp/mediainfo". We'll have to look into how to give the mediainfo file execute permission and preserve it in the zip file in the dotnet lambda deploy-function tool. That may be difficult to do on windows. |
I've seen this mentioned elsewhere as a possible problem (along with your suggested solution), but as I said, the same binary works with a Node.js lambda, packaged from the same Windows machine, albeit using a different process to create the zip. The Node.js package is created using a build script that zips up using the npm package "archiver," whereas I've tried zipping the .NET package using both the deploy function tool through Visual Studio and a PowerShell script. Are you saying the zipping process is what really matters here? |
It seems that way. Let me look into it some more and get back to you. |
I've spoken with a colleague who's told me that the way Node.js runs the process (via the child_process module) is actually the reason this works with a Node.js lambda function. Supposedly the execFile function used to invoke the executable will set the execute permission bit automatically prior to running it. So far I've been unable to confirm this, either through documentation or source code, so I may just have to take his word for it. If you (or anyone else with a little more Node.js knowledge?) can corroborate what he's saying, that would be helpful. |
You can change the file attributes in the deployment package zip and then deploy the altered archive.
We'll look into adding a feature into the tooling to take care of this in the future. |
Turns out my colleague's assertion about the child_process module was incorrect. It appears that in the case of the Node.js lambda I was using as an example, the build process used to do the packaging is handling setting the permissions when creating the zip, exactly as you've suggested doing for the .NET Core case. Unfortunately it doesn't look like this can be done with PowerShell's Compress-Archive (see open issue here), which I'd been hoping to use in conjunction with the dotnet CLI and Terraform to run a scripted deployment. I'll have to do some variation on what you've suggested. Thanks so much for the help. |
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:
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:
I believe I've done the .NET equivalent with the following line:
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?
The text was updated successfully, but these errors were encountered: