Matthew Cantrell
Matthew Cantrell

Reputation: 41

Publish to AWS Lamba - Failed to find the "build-lambda-zip" utility

I'm currently trying to publish my AWS lambda functions using Visual Studio 2019 community (v4.8.03752) and leveraging the AWS Toolkit for Visual Studio (v1.20.1.0). After right clicking my project and selecting 'Publish to AWS Lambda' I receive the following error:

- Zipping publish folder C:\Users\Matt\source\repos\programName\programName\.\bin\Release\netcoreapp3.1\publish to C:\Users\Matt\AppData\Local\Temp\HelloWorld-CodeUri-Or-ImageUri-637489827969959200.zip
- Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.
- Error packaging up project in C:\Users\Matt\source\repos\programName\programName\. for CloudFormation resource HelloWorld: Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.

I've been able to deploy this MANY times over previous months, up until Friday 2/12 when I started receiving this error (after a reboot). What's even more strange is that if I uninstall the AWS Toolkit for VS, then reinstall it, I'm able to publish successfully 1 time. With my 2nd attempt, I begin to receive this error again.

Steps I've taken to attempt to resolve:

UPDATE:

Per some comments below, it looks like this is being caused by McAfee Real-Time Scanning. In checking the logs during a deployment I noticed a "Virus or threat found" record that points directly to the build-lambda-zip.exe file. To permanently avoid this issue moving forward please follow the steps provided by user2174794 in the comments below.

Upvotes: 4

Views: 2042

Answers (6)

Andras
Andras

Reputation: 63

I know the question is in a windows system, but under a linux system, in my case the following command was needed:

sudo apt-get -y install zip

Upvotes: 1

user2174794
user2174794

Reputation: 59

I also faced the same issue, This is because the "build-lambda-zip.exe" file is getting removed by the McAfee Antivirus.

For the permanent fix, you need to follow the below steps.

Step 1

Go to McAfee Settings >> Quarantined Items

You will find the "build-lambda-zip.exe" file there. Restore it to the original location.

Now If you will try to publish, the error won't get displayed. But again on the next scan, the file will get removed.

Step 2

We need to Exclude this file from getting Scanned and removed. So for that,

Go to McAfee Settings >> Real-Time Scanning and Add the "build-lambda-zip.exe" file in the Excluded files list.

For the file path of "build-lambda-zip.exe" got to C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\ and search for the file name.

enter image description here

Upvotes: 3

Jose Miguel
Jose Miguel

Reputation: 31

I have the same problem, it was because my antivirus detect the executable build-lambda-zip.exe, then delete it.

I restore the executable from my antivirus, or restore dotnet tools with the command :

dotnet tool update -g Amazon.Lambda.Tools

Upvotes: 3

ThorPF
ThorPF

Reputation: 53

Maybe you should try reinstalling the AWS Tool Kit and before you make deployments please turn off your antivirus protection. I was troubbling the same issue and my antivirus(McAfee) was deleting build-lambda-zip.exe file when I did deployment first time.

Upvotes: 2

Jimmy James
Jimmy James

Reputation: 51

I'm having the same issue. Just started happening today. It was working within the last 2 weeks.

Failed to find the "build-lambda-zip" utility. This program is required to maintain Linux file permissions in the zip archive.

Running Windows 10, Visual Studio 2019

My solution for now is to use the .NET Core CLI

https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/lambda-cli-publish.html

Specifically, the

dotnet lambda deploy-function

A recent update must have broke the AWS Toolkit For Visual Studio.

enter image description here

Upvotes: 5

Norm Johanson
Norm Johanson

Reputation: 3177

I'm curious about the state of the extension installation. Can you go to VS's extension directory in Windows explorer C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Extensions and in the search box search for AWSToolkitPackage.dll.

enter image description here

Ideally it should only show one instance of that file. Assuming it finds a single instance right click on the file and select "Open File Location". Now that you are in the root folder of the AWS extension check the Resources folder and see if it contains the file build-lambda-zip.exe.

enter image description here

Upvotes: 0

Related Questions