Skip to content
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

SAM build continually updates Lambda Tools #347

Open
XXChester opened this issue Mar 18, 2022 · 5 comments
Open

SAM build continually updates Lambda Tools #347

XXChester opened this issue Mar 18, 2022 · 5 comments
Labels

Comments

@XXChester
Copy link

Description:
Hello AWS, is there a way to disable sam build from trying to update the lambda tools? I have the latest installed and it continually tries to upgrade them but this takes several minutes each sam build. You can see in the log below that it says it is successful in the upgrade but when I run sam build again, it again upgrades the tools (to the same version). This is causing significant development delays in my workflow so I was wondering if there is a way to disable this feature?

Installing Amazon.Lambda.Tools Global Tool
2022-03-18 09:28:12,947 | executing dotnet: ['dotnet', 'tool', 'install', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']
2022-03-18 09:28:13,170 |
2022-03-18 09:28:13,170 | Error installing probably due to already installed. Attempt to update to latest version.
2022-03-18 09:28:13,170 | executing dotnet: ['dotnet', 'tool', 'update', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']
2022-03-18 09:30:49,724 | Tool 'amazon.lambda.tools' was reinstalled with the latest stable version (version '5.3.0').
2022-03-18 09:30:49,724 | DotnetCliPackageBuilder:GlobalToolInstall succeeded

As a side note, I have uninstalled and reinstalled the tools several times with dotnet tools directly which doesn't seem to fix the issue.

SAM build continually upgrades the AWS Lambda Tools and doesn't recognize that it has installed the latest already.

Steps to reproduce the issue:

  1. sam build

Observed result:
SAM doesn't detect the latest version of lambda tools is already installed in the global space
Expected result:
SAM should not try to upgrade the tools when it is already running the latest.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Osx, SAM CLI version 1.40.1

@XXChester
Copy link
Author

As a temporary solution, I have hacked out the check in my local aws-sam-cli.

@mildaniel
Copy link
Contributor

mildaniel commented Mar 22, 2022

Thanks for reporting the issue, we will be investigating it further. Sounds like we might want to have some flag to disable the installation or add some logic to ensure we don't do this every time.

@cskeppstedt
Copy link

Seems like I have this issue now as well. Quite often my build task gets stuck (or takes a very long time) on this:

2024-01-16 10:46:55,846 | Running workflow 'DotnetCliPackageBuilder'
2024-01-16 10:46:55,846 |  Running DotnetCliPackageBuilder:GlobalToolInstall
2024-01-16 10:46:55,846 | Entered synchronized block for updating Amazon.Lambda.Tools
2024-01-16 10:46:55,847 | Installing Amazon.Lambda.Tools Global Tool
2024-01-16 10:46:55,847 | executing dotnet: ['dotnet', 'tool', 'install', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']

And sometimes it will retry with this message:

2024-01-16 10:45:18,446 | Error installing probably due to already installed. Attempt to update to latest version.
2024-01-16 10:45:18,447 | executing dotnet: ['dotnet', 'tool', 'update', '-g', 'Amazon.Lambda.Tools', '--ignore-failed-sources']

Same for building for .net 6 or 7, on mac osx (14.2), SAM CLI version 1.107.0

@rossobianero
Copy link

rossobianero commented Feb 8, 2024

Same issue, and it's driving me crazy. In addition to the unnecessary amount of time it takes, it will often cause the build to fail (vscode on windows):

I get this error about once per day:
Failed to uninstall tool package 'amazon.lambda.tools': Access to the path 'C:\Users\Username\.dotnet\tools\.store\amazon.lambda.tools\5.9.0' is denied.

@XXChester you mentioned a "hack" workaround. Can you tell us how to do that?

BTW when the path is access denied, it's usually because dotnet-lambda.exe is hanging on to it. So, killing that process can (sometimes) get you out of that

@XXChester
Copy link
Author

@rossobianero it was fairly simple, I located the SAM cli files and commented out the update method. I don't have it anymore as we moved away from SAM (sadly :( ) but that was is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants