Some Azure modules (e.g.. Az.Resources and Az.ConnectedMachine) causing packaging to fail (I'm using New-AWSPowerShellLambdaPackage).
I think this is due to .cs files within them and might need to be excluded in csproj. But not sure.
I'm running from an Ubuntu GitHub Actions runner.
Example errors:
Staging deployment at /tmp/project-name
Configuring PowerShell to version 7.6.0
Generating C# project /tmp/project-name/project-name.csproj used to create Lambda function bundle.
Generating /tmp/project-name/Bootstrap.cs to load PowerShell script and required modules in Lambda environment.
Generating aws-lambda-tools-defaults.json config file with default values used when publishing project.
Copying PowerShell script to staging directory
Saving module AWS.Tools.Common
Saving module AWS.Tools.SecretsManager
VERBOSE: Populating RepositorySourceLocation property for module Az.Accounts.
VERBOSE: Found installed module Az.Accounts (5.5.0) to save with package bundle.
Copying local module Az.Accounts(5.5.0) from /usr/share/az_15.6.1/Az.Accounts/5.5.0
VERBOSE: Populating RepositorySourceLocation property for module Az.ConnectedMachine.
VERBOSE: Found installed module Az.ConnectedMachine (1.1.1) to save with package bundle.
Copying local module Az.ConnectedMachine(1.1.1) from /usr/share/az_15.6.1/Az.ConnectedMachine/1.1.1
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.Common/5.0.158/AWS.Tools.Common.dll-Help.xml
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.Common/5.0.158/AWS.Tools.Common.XML
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.Common/5.0.158/PSGetModuleInfo.xml
VERBOSE: Stripped 3 unwanted file(s) from AWS module AWS.Tools.Common
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.SecretsManager/5.0.158/AWS.Tools.SecretsManager.dll-Help.xml
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.SecretsManager/5.0.158/AWS.Tools.SecretsManager.XML
VERBOSE: Removing AWS module file: /tmp/project-name/Modules/AWS.Tools.SecretsManager/5.0.158/PSGetModuleInfo.xml
VERBOSE: Stripped 3 unwanted file(s) from AWS module AWS.Tools.SecretsManager
Resolved full output package path as /home/runner/work/repo-name/repo-name/lambda/project-name/project-name.zip
Creating deployment package at /home/runner/work/repo-name/repo-name/lambda/project-name/project-name.zip
Restoring .NET Lambda deployment tool
VERBOSE: Installing .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 net10.0 --function-runtime dotnet10 --output-package "/home/runner/work/repo-name/repo-name/lambda/project-name/project-name.zip"
VERBOSE: Amazon Lambda Tools for .NET Core applications (7.0.0)
VERBOSE: Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
VERBOSE:
VERBOSE: Executing publish command
VERBOSE: ... invoking 'dotnet publish', working folder '/tmp/project-name/bin/Release/net10.0/publish'
VERBOSE: ... dotnet publish "/tmp/project-name" --output "/tmp/project-name/bin/Release/net10.0/publish" --configuration "Release" --framework "net10.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained False
VERBOSE: ... publish: Determining projects to restore...
VERBOSE: ... publish: Restored /tmp/project-name/project-name.csproj (in 4.59 sec).
VERBOSE: ... publish: /tmp/project-name/Modules/Az.ConnectedMachine/1.1.1/ConnectedMachine.Autorest/custom/MachineExtensionProperties.json.cs(2,59): error CS0234: The type or namespace name 'Runtime' does not exist in the namespace 'Microsoft.Azure.PowerShell.Cmdlets.ConnectedMachine' (are you missing an assembly reference?) [/tmp/project-name/project-name.csproj]
[...]
VERBOSE: ... publish: /tmp/project-name/Modules/Az.ConnectedMachine/1.1.1/ConnectedMachine.Autorest/custom/MachineExtensionProperties.json.cs(22,22): error CS0759: No defining declaration found for implementing declaration of partial method 'MachineExtensionUpdateProperties.AfterToJson(ref JsonObject)' [/tmp/project-name/project-name.csproj]
[...]
VERBOSE: ERROR: The dotnet publish command return unsuccessful error code
Exception: /home/runner/.local/share/powershell/Modules/AWSLambdaPSCore/5.0.2.0/Private/_DeploymentFunctions.ps1:290
Line |
290 | throw $msg
| ~~~~~~~~~~
| Error publishing PowerShell Lambda Function: 255 CALLSTACK: Command
| Arguments ------- ---------
| _packageProject
| {OutputPackage=/home/runner/work/repo-name/cyber-aws-s… New-AWSPowerShellLambdaPackage {ScriptPath=project-name.ps1, OutputPackage=project-name.zip, Verbose=Tr… 6b82c2b1-8675-49db-9a10-da809d706dd4.ps1 {} <ScriptBlock> {}
Error: Process completed with exit code 1.
Some Azure modules (e.g..
Az.ResourcesandAz.ConnectedMachine) causing packaging to fail (I'm usingNew-AWSPowerShellLambdaPackage).I think this is due to .cs files within them and might need to be excluded in csproj. But not sure.
I'm running from an Ubuntu GitHub Actions runner.
Example errors: