简体   繁体   中英

How to run `dotnet lambda deploy-serverless` command without parameters?

Good evening. The question is about do.net lambda deploy-serverless command. This command is used to deploy.Net apps to AWS Lambda service using AWS CloudFormation. When I try to run this command in Jenkins pipeline in stage:

stage('Update AWS lambda') {
            steps {
                bat "cd MyFinance.Api"
                bat "dotnet lambda deploy-serverless"
            }
        } 

I receive errors about missing parameters:

C:\Program Files (x86)\Jenkins\workspace\MyFinanceApiPipeline>do.net lambda deploy-serverless Amazon Lambda Tools for .NET Core applications (4.1.0) Project Home: https://github.com/aws/aws-extensions-for-do.net-cli , https://github.com/aws/aws-lambda-do.net Enter CloudFormation Stack Name: (CloudFormation stack name for an AWS Serverless application) Enter S3 Bucket: (S3 bucket to upload the build output) Enter CloudFormation Template: (Path to the CloudFormation template) Enter AWS Region: (The region to connect to AWS services, if not set region will be detected from the environment.) Can not determine AWS region. Either configure a default region or use the --region option.

But if I run this command via PowerShell in my project folder everything is ok. Near is a screenshot of command execution results. Successful command execution in PowerShell So, how to run this without parameters in Jenkins pipeline (like I made via PowerShell)? Thank you in advance.

This happens when you don't pass those requested parameters. You may pass these as arguments to the command

dotnet lambda deploy-serverless --stack-name replace-your-stack-name-here --s3-bucket replace-s3-bucket-name-here --region replace-with-region

You will have to navigate the folder where you have the "serverless.template" file before running this command. or optionally you can pass the path to the template file with the argument -t

If you are deploying from Azure DevOps and getting this error,

1. Error: The process '/home/vsts/.dotnet/tools/dotnet-lambda' failed with exit code 255
2. "Missing" required parameter: --template

Make sure to navigate to the folder where you have the "serverless.template" file on Path to Lambda Project $(System.DefaultWorkingDirectory)/Buildfolder/ArtifactsFolder/severless.template_folder

Same error on Azure Devops

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM