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

AWS Lambda Tools for PowerShell: PackageScript & PackageProject parameter sets aren't documented clearly #1821

Open
sixfootdad opened this issue Sep 25, 2024 · 1 comment
Labels
doc-readme documentation This is a problem with documentation. module/lambda-client-lib p2 This is a standard priority issue queued

Comments

@sixfootdad
Copy link

Describe the issue

While the comment-based help mentions script & project workflows in both New-AWSPowerShellLambda & New-AWSPowerShellLambdaPackage, it isn't very clear how one would utilize those two options.

For example, when creating a new script using the basic template with New-AWSPowerShellLambda -Template Basic
the output will create a new AWS Lambda PowerShell script Basic.ps1 from template Basic.ps1.txt at ./Basic.
If New-AWSPowerShellLambdaPackage -ProjectDirectory ./Basic -OutputPackage ./Basic.zip is run, packaging will fail as ProjectDirectory belongs to the PackageProject parameter set (but the error messaging isn't super clear on why).

tl;dr - it's easy to mix up the parameter sets unknowingly, and the comment-based help doesn't make that clear.

Links

@sixfootdad sixfootdad added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Sep 25, 2024
@ashishdhingra ashishdhingra added module/lambda-client-lib investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 25, 2024
@ashishdhingra ashishdhingra self-assigned this Sep 25, 2024
@ashishdhingra ashishdhingra added the p2 This is a standard priority issue label Sep 25, 2024
@ashishdhingra
Copy link
Contributor

@sixfootdad Good afternoon. Thanks for opening the issue. Error is reproducible with your scenario giving below message:

Copying local module AWS.Tools.Common(4.1.491) from /Users/REDACTED/.local/share/powershell/Modules/AWS.Tools.Common/4.1.491
Resolved full output package path as /Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip               
Creating deployment package at /Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip
Restoring .NET Lambda deployment tool
Initiate packaging
Exception: /Users/REDACTED/.local/share/powershell/Modules/AWSLambdaPSCore/4.0.0.0/Private/_DeploymentFunctions.ps1:279
Line |
 279 |              throw $msg
     |              ~~~~~~~~~~
     | Error publishing PowerShell Lambda Function: 255 CALLSTACK: Command                        Arguments -------          
     | ---------                                                                                       _packageProject       
     | {OutputPackage=/Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip, BuildDire…
     | New-AWSPowerShellLambdaPackage {ProjectDirectory=./Basic, OutputPackage=./Basic.zip}                                  
     | <ScriptBlock>                  {}

However, if you use the -Verbose parameter, it emits below in the output:

VERBOSE: Populating RepositorySourceLocation property for module AWS.Tools.Common.
VERBOSE: Found installed module AWS.Tools.Common (4.1.491) to save with package bundle.
Copying local module AWS.Tools.Common(4.1.491) from /Users/REDACTED/.local/share/powershell/Modules/AWS.Tools.Common/4.1.491
Resolved full output package path as /Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip               
Creating deployment package at /Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip
Restoring .NET Lambda deployment tool
VERBOSE: Updating .NET Global Tool Amazon.Lambda.Tools
VERBOSE: Looking for windows excutable for dotnet-lambda.exe
VERBOSE: Did not find windows executable, assuming on non windows platform and using dotnet-lambda
Initiate packaging
VERBOSE: ~/.dotnet/tools/dotnet-lambda package  --configuration Release --framework net8.0 --function-runtime dotnet8 --output-package "/Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip"
VERBOSE: Amazon Lambda Tools for .NET Core applications (5.10.7)
VERBOSE: Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
VERBOSE: 	
VERBOSE: No .NET project found in directory /Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/Basic to build.
Exception: /Users/REDACTED/.local/share/powershell/Modules/AWSLambdaPSCore/4.0.0.0/Private/_DeploymentFunctions.ps1:279
Line |
 279 |              throw $msg
     |              ~~~~~~~~~~
     | Error publishing PowerShell Lambda Function: 255 CALLSTACK: Command                        Arguments -------          
     | ---------                                                                                       _packageProject       
     | {OutputPackage=/Users/REDACTED/dev/repros/PowerShellLambdaTest/Issue1821/./Basic.zip, BuildDire…
     | New-AWSPowerShellLambdaPackage {ProjectDirectory=./Basic, OutputPackage=./Basic.zip, Verbose=True}                    
     | <ScriptBlock>                  {}

The error is thrown by the underlying AWS .NET CLI Extensions tooling.

Please advise the content update you propose to document this scenario clearly.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 27, 2024
@bhoradc bhoradc added queued doc-readme and removed response-requested Waiting on additional info and feedback. Will move to close soon in 7 days. labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-readme documentation This is a problem with documentation. module/lambda-client-lib p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

3 participants