Skip to content

project-location is relative to the folder of the template, not the working directory #214

@hauntingEcho

Description

@hauntingEcho

Describe the bug

project-location is documented as: "The location of the project, if not set the current directory will be assumed."

It actually is relative to, and defaults to, the folder of your template file rather than your current working directory.

Expected Behavior

project location is relative to, and defaults to, the current working directory

Current Behavior

project location actually is relative to, and defaults to, the folder of your template file.

Reproduction Steps

Commands assume you're using git-bash on Windows 10:

  1. in an empty folder, run dotnet new lambda.EmptyFunction && touch serverless.yaml
  2. copy the template below into the serverless.yaml file you've just created
  3. cd src/lambda-example
  4. run dotnet lambda package-ci -t ../../serverless.yaml -sb "${bucket}" --output-template compiled.yaml using a bucket in your default region to which you have write-access
  5. see the bug - it'll zip everything in your current folder without building anything
  6. cp ../../serverless.yaml . && cd ../.. && dotnet lambda package-ci -t src/lambda-example/serverless.yaml -sb "${bucket}" --output-template compiled.yaml
  7. see the bug - failure should be expected, but it works

serverless.yaml:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  LambdaAuthorizer:
    Type: AWS::Lambda::Function
    Properties:
      Runtime: dotnet6
      Handler: lambda-example::lambda_example.Function::FunctionHandler

Possible Solution

Update the documentation - this would be a breaking change, and probably not worth actually changing the behavior.

Additional Information/Context

No response

Targeted .NET platform

$ dotnet --version
6.0.202

CLI extension version

$ dotnet tool list -g
Package Id Version Commands

amazon.lambda.testtool-3.1 0.12.1 dotnet-lambda-test-tool-3.1
amazon.lambda.testtool-6.0 0.12.1 dotnet-lambda-test-tool-6.0
amazon.lambda.tools 5.1.4 dotnet-lambda
dotnet-ef 5.0.9 dotnet-ef
dotnet-reportgenerator-globaltool 4.8.12 reportgenerator

Environment details (OS name and version, etc.)

Windows 10, git bash

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.module/cli-extp3This is a minor priority issuequeued

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions