aws / aws-sam-cli

CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM
https://aws.amazon.com/serverless/sam/
Apache License 2.0
6.5k stars 1.17k forks source link

Bug: option --base-dir does not work #6937

Closed stationname closed 1 month ago

stationname commented 5 months ago

Description:

--base-dir does not apply the given directory to relative path in --config-file

Steps to reproduce:

(1) project structure:

/ 
    my_lambda_project1
          build_and_deploy
                samconfig.toml
                template.yaml
    my_lambda_project2
          ...

(2) move to root directory (/)

(3) run sam build --base-dir "./my_lambda_project1" --config-file "./build_and_deploy/samconfig.toml"

Observed result:

2024-04-12 16:39:57,170 | Config file ./build_and_deploy/samconfig.toml does not exist or could not be   
read!                                                                                                         
Error: Config file ./build_and_deploy/samconfig.toml does not exist or could not be read!

Expected result:

sam starts building using the samconfig.toml file

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

sam --info:

{
  "version": "1.115.0",
  "system": {
    "python": "3.12.2",
    "os": "macOS-14.3.1-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "20.10.16",
    "aws_cdk": "2.61.1 (build d319d9c)",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}
jysheng123 commented 5 months ago

Hi, thanks for bringing up the issue. Can you try running the build again with the command with it like this and let me know your result then? sam build --base-dir "./my_lambda_project1" --config-file "build_and_deploy/samconfig.toml".

mildaniel commented 1 month ago

Closing due to inactivity. If the issue persists, please open a new issue.

github-actions[bot] commented 1 month ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.