4

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:

  • Repair Visual Studio
  • Uninstall/Reinstall Visual Studio
  • Uninstall and reinstall amazon.lambda.tools using dotnet tool install -g Amazon.Lambda.Tools
  • Uninstall AWS Toolkit for VS, Reinstall toolkit. (This works for first deployment, fails when trying to deploy a 2nd time)

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.

  • Hi, just wanted to tell you that you are not alone having this problem. I have exactly same problem. Exactly same thing is happening with my visual studio, with all my lambdas, since this morning. Hope that we find solution soon. – Karel Křesťan Feb 23 '21 at 12:48

6 Answers6

5

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

  • This post is not an answer for the OP's question. – Kristianne Nerona Feb 16 '21 at 02:32
  • 1
    I added my solution. Thanks. – Jimmy James Feb 16 '21 at 15:47
  • @norm I am missing the file in question. See my directory screenshot added to my answer please. – Jimmy James Feb 19 '21 at 18:16
  • @Jimmy - I checked and it was missing for me too. I uninstalled the AWS Toolkit for VS and then reinstalled it and it was there again. For the time being, I copied it to my desktop and I'm just pasting it back in after the deployment. This seems to be working for the time being, but it definitely needs to be addressed long term. – Matthew Cantrell Feb 22 '21 at 19:05
  • 1
    Looks like it was McAfee. I found build-lambda-zip.exe in the quarantine folder. I was able to restore from there. Uhg. – Jimmy James Mar 18 '21 at 03:15
  • It was McAfee for me too, adding that executable to excluded files helped me fix this issue - https://service.mcafee.com/webcenter/portal/cp/home/articleview?articleId=TS102056 – Manik Arora Mar 25 '21 at 05:22
3

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

3

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

2

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.

ThorPF
  • 53
  • 6
1

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
Andras
  • 43
  • 6
0

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

Norm Johanson
  • 2,964
  • 14
  • 13
  • Hi Norm - I checked to see if build-lambda-zip.exe was in that directory and it wasn't (this would be after my 1st time deployment that succeeded). I wanted to see what the directory looked like after uninstalling and reinstalling the AWS Toolkit and it looks like build-lambda-zip IS there when re-installing the tool. There must be some process that is removing that file during 'Publish to AWS Lambda'. I did a deployment and watched the directory. It looks like the file was removed after it was done compiling/zipping and as it was opening the CloudFormation Stack window in VS. – Matthew Cantrell Feb 22 '21 at 14:26
  • There is nothing in the VS toolkit code to delete the file. The file is installed as part of the extensions install which you saw. Something external must be deleting the file. Do you have anything special with your virus/malware detection software? Can you share what version of Windows 10 your running? – Norm Johanson Feb 25 '21 at 17:40
  • it looks like it's McAfee identifying the file as a threat during processing. I was able to circumvent the issue by disabling real-time scanning. I'll have to submit this as an exception to McAfee. – Matthew Cantrell Mar 04 '21 at 14:33