Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Missing DockerContext doesn't fail validation #7017

Open
palfrey opened this issue May 3, 2024 · 2 comments
Open

Bug: Missing DockerContext doesn't fail validation #7017

palfrey opened this issue May 3, 2024 · 2 comments
Labels

Comments

@palfrey
Copy link

palfrey commented May 3, 2024

Description:

If you set Dockerfile in a function's metadata, but not DockerContext, sam build seems to just work, except then sam local invoke complains Error: ImageUri not provided for Function: YourFunctionName of PackageType: Image which is very confusing. Note also sam validate doesn't complain abou this.

Steps to reproduce:

Create a correct docker image SAM template, then remove just the DockerContext metadata param.

Observed result:

sam local invoke fails with a confusing error

Expected result:

sam validate fails, or maybe sam build?

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

  1. OS: MacOS
  2. sam --version: 1.116.0
{
  "version": "1.116.0",
  "system": {
    "python": "3.11.6",
    "os": "macOS-14.0-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "docker_engine": "23.0.6",
    "aws_cdk": "Not available",
    "terraform": "1.4.1"
  },
  "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"
  ]
}
@palfrey palfrey added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label May 3, 2024
@fedor-pavlov
Copy link

Same for me here! I was caught in this trap yesterday.

@mildaniel
Copy link
Contributor

Thanks @palfrey for reporting. I was able to confirm the behaviour you're describing. The main issue to me here seems not properly handling the missing DockerContext during sam build since it doesn't end up building any images. I will mark it as a bug for the team to prioritize.

@mildaniel mildaniel added type/bug and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants