Hello everybody,
Internet is large but I really could not find an answer.
I am developing AWS Lambda (NET6) and now I am trying to create a Github Action to build and deploy my function to AWS. Manually I do it but now want to automate.
Here is my yml file
name: .NET->AWS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
AWS_REGION: eu-west-2
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: AWS CLI
run: dotnet tool install -g Amazon.Lambda.Tools
- name: Build
run: dotnet build -c release
- name: Deploy to Lambda
run: dotnet lambda deploy-serverless
The project was built ok.
The result of the Action is:
Deploy to Lambda
Run dotnet lambda deploy-serverless
dotnet lambda deploy-serverless
shell: /usr/bin/bash -e {0}
env:
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_REGION: eu-west-2
Amazon Lambda Tools for .NET Core applications (5.7.2)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Enter CloudFormation Stack Name: (CloudFormation stack name for an AWS Serverless application)
Enter CloudFormation Template: (Path to the CloudFormation template)
Enter S3 Bucket: (S3 bucket to upload the build output)
Warning: Unable to determine region for bucket , assuming bucket is in correct region: BucketName is a required property and must be set before making this call. (Parameter 'GetBucketLocationRequest.BucketName')
Unknown error executing command: Value cannot be null. (Parameter 'path2')
at System.IO.Path.Combine(String path1, String path2)
at Amazon.Lambda.Tools.Commands.DeployServerlessCommand.PerformActionAsync() in C:\build\src\Amazon.Lambda.Tools\Commands\DeployServerlessCommand.cs:line 145
at Amazon.Common.DotNetCli.Tools.Commands.BaseCommand`1.ExecuteAsync() in C:\build\src\Amazon.Common.DotNetCli.Tools\Commands\BaseCommand.cs:line 49
Error: Process completed with exit code 255.
What can be the reason?
Hi, another example is this project of mine: https://github.com/didier-durand/lambda-cobol with all code of Action published
I have made as described on the link https://aws.amazon.com/blogs/compute/using-github-actions-to-deploy-serverless-applications/
but received the error: Starting Build inside a container Error: Template file not found at /home/runner/work/<myLambdaProject>/template.yaml Error: Process completed with exit code 1. How to fix it?
Is that path correct? Seems yaml could not be found
@Antonio_Lagrotteria : The path is correct but this file (template.yaml) does not exist in the project. Where can I get it: or how to create?
It should be generated by sam init command.