aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

Bug: sam sync does not have --container-env-var-file parameter

Open zyrorl opened this issue 1 year ago • 4 comments

Description:

It appears that sam sync doesn't support passing in of --container-env-var-file when using the --use-container flag.

This means that when building the code it's missing any environment variables needed to compile the project.

Steps to reproduce:

Run sam sync --use-container --container-env-var-file container.env.json. Variable files are not respected as per sam build or other commands.

Observed result:

Container builds that require env vars have those vars unset.

Expected result:

Environment variables are passed into container as per sam build

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

{
  "version": "1.104.0",
  "system": {
    "python": "3.11.3",
    "os": "Linux-5.10.201-191.748.amzn2.x86_64-x86_64-with-glibc2.26"
  },
  "additional_dependencies": {
    "docker_engine": "20.10.25",
    "aws_cdk": "2.114.1 (build 02bbb1d)",
    "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"
  ]
}

zyrorl avatar Dec 09 '23 21:12 zyrorl

Hi, thanks for bringing up the issue. It looks like we only support --container-env-file option on sam build currently, but this looks like a quick feature request to implement. I will let the team know about it to see about putting it in the future.

jysheng123 avatar Dec 12 '23 15:12 jysheng123

any updates on this?

zyrorl avatar Feb 01 '24 03:02 zyrorl

@jysheng123 i would like to work on this. But, I'm facing one issue while writing unit tests for same. I tried searching in CONTRIBUTING.md file but not found. Can you share me specific doc/contributing reference guide ? Thanks

nitintecg avatar Feb 25 '24 17:02 nitintecg

Hi @nitintecg, if you are interested to contribute feel free to open a PR and our team would be happy to review and assist with unit tests. I don't recall if we have specific guidelines on writing unit tests, but you can follow the existing unit tests to get some idea.

hnnasit avatar Apr 19 '24 21:04 hnnasit

Closing as the PR has been merged and released.

hnnasit avatar Jun 09 '24 17:06 hnnasit

⚠️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.

github-actions[bot] avatar Jun 09 '24 17:06 github-actions[bot]