Skip to content

Bug: sam sync fails for Docker Image Functions - FunctionNotFound #8381

@ivancsicsmarkus

Description

@ivancsicsmarkus

Description:

sam sync fails when I have an Image Function in my nested stack.

Steps to reproduce:

Create a nested SAM stack. One of the nested stacks should have a single Function with ImageUri set to an ECR repository.
This stack deploys perfectly with normal commands. Run sam sync. It fails.
If you comment out the Image Function, sam sync works.

Observed result:

I get the following trace:

Traceback:
  File "click/core.py", line 1082, in main
  File "click/core.py", line 1697, in invoke
  File "click/core.py", line 1443, in invoke
  File "click/core.py", line 788, in invoke
  File "samcli/cli/cli_config_file.py", line 366, in wrapper
  File "click/decorators.py", line 92, in new_func
  File "click/core.py", line 788, in invoke
  File "samcli/lib/telemetry/metric.py", line 190, in wrapped
  File "samcli/lib/telemetry/metric.py", line 155, in wrapped
  File "samcli/lib/telemetry/event.py", line 382, in wrapped
  File "samcli/lib/telemetry/event.py", line 374, in wrapped
  File "samcli/lib/cli_validation/image_repository_validation.py", line 111, in wrapped
  File "samcli/lib/telemetry/metric.py", line 109, in wrapped
  File "samcli/lib/utils/version_checker.py", line 43, in wrapped
  File "samcli/cli/main.py", line 95, in wrapper
  File "samcli/commands/_utils/cdk_support_decorators.py", line 40, in wrapped
  File "samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
  File "samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
  File "samcli/commands/sync/command.py", line 229, in cli
  File "samcli/commands/sync/command.py", line 411, in do_cli
  File "samcli/commands/sync/command.py", line 572, in execute_watch
  File "samcli/lib/sync/watch_manager.py", line 226, in start
  File "samcli/lib/sync/watch_manager.py", line 254, in _start_sync
  File "samcli/lib/sync/watch_manager.py", line 142, in _add_code_triggers
  File "samcli/lib/utils/code_trigger_factory.py", line 120, in create_trigger
  File "samcli/lib/utils/code_trigger_factory.py", line 54, in _create_lambda_trigger
  File "samcli/lib/utils/resource_trigger.py", line 239, in __init__

Error is FunctionNotFound, but nothing is in the debug logs.
Relevant code part:

raise FunctionNotFound()

Expected result:

sam sync should have no problems running with Image Functions.

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

  1. OS: Mac 15.6.1
  2. sam --version: SAM CLI, version 1.145.2
  3. AWS region: eu-central-1
{
  "version": "1.145.2",
  "system": {
    "python": "3.11.10",
    "os": "macOS-15.6.1-arm64-arm-64bit"
  },
  "additional_dependencies": {
    "container_engine": "Docker(v28.3.2)",
    "aws_cdk": "Not available",
    "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_PACKAGE_PERFORMANCE",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    stage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions