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: sam sync - TypeError #7581

Closed
914005 opened this issue Oct 18, 2024 · 15 comments
Closed

Bug: sam sync - TypeError #7581

914005 opened this issue Oct 18, 2024 · 15 comments
Labels
area/sync sam sync command type/bug

Comments

@914005
Copy link

914005 commented Oct 18, 2024

Description:

When running sam sync --stack-name [my stack name] --watch, the stack update success, but then the following error is returned:

Stack update succeeded. Sync infra completed.                                                                                                                                                                              
                                                                                                                                                                                                                           

Error: BaseObserver.schedule() takes 3 positional arguments but 4 were given
Traceback:
  File "click/core.py", line 1078, in main
  File "click/core.py", line 1688, in invoke
  File "click/core.py", line 1434, in invoke
  File "click/core.py", line 783, in invoke
  File "samcli/cli/cli_config_file.py", line 347, in wrapper
  File "click/decorators.py", line 92, in new_func
  File "click/core.py", line 783, in invoke
  File "samcli/lib/telemetry/metric.py", line 185, in wrapped
  File "samcli/lib/telemetry/metric.py", line 150, in wrapped
  File "samcli/lib/telemetry/event.py", line 376, in wrapped
  File "samcli/lib/telemetry/event.py", line 368, in wrapped
  File "samcli/lib/cli_validation/image_repository_validation.py", line 111, in wrapped
  File "samcli/lib/telemetry/metric.py", line 104, 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 230, in start
  File "samcli/lib/sync/watch_manager.py", line 245, in _start
  File "samcli/lib/sync/watch_manager.py", line 285, in _execute_infra_sync
  File "samcli/lib/sync/watch_manager.py", line 253, in _start_sync
  File "samcli/lib/sync/watch_manager.py", line 186, in _add_template_triggers
  File "samcli/lib/utils/path_observer.py", line 153, in schedule_handlers
  File "samcli/lib/utils/path_observer.py", line 170, in schedule_handler

An unexpected error was encountered while executing "sam sync".

Steps to reproduce:

sam sync --stack-name [my stack name] --watch
I'm running with Python 3.9.16

Observed result:

See above in description.

Expected result:

sam sync should run without error. Internal python code error in the samcli should be resolved.

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

{
  "version": "1.126.0",
  "system": {
    "python": "3.11.10",
    "os": "Linux-6.1.112-122.189.amzn2023.x86_64-x86_64-with-glibc2.34"
  },
  "additional_dependencies": {
    "docker_engine": "25.0.6",
    "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_RUST_CARGO_LAMBDA"
  ]
}

Add --debug flag to command you are running
See error message above.

@914005 914005 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Oct 18, 2024
@keeano92
Copy link

Exact Same Error as above, have tried:
Through these steps and many others, I am still getting this error.

Thoroughly clean your environment:
Uninstall SAM CLI and watchdog:
Bash
pip uninstall aws-sam-cli watchdog

Remove any residual files: Manually delete any SAM CLI or watchdog related files or folders in your Python installation directory.
Clear pip cache:
Bash
pip cache purge

  1. Reinstall in a fresh virtual environment:
    Create a new virtual environment: Set up a brand new virtual environment to ensure a clean slate.
    Install SAM CLI: Install the latest SAM CLI within the activated virtual environment.

  2. Check for conflicting packages:
    Inspect installed packages: Use pip list to see all installed packages in your environment.
    Identify potential conflicts: Look for any packages that might interfere with watchdog or its dependencies.
    Try uninstalling or updating: If you find any suspicious packages, try uninstalling or updating them.

  3. Examine system-level dependencies:

System Python: If you're using the system-wide Python installation, there might be conflicts with other system packages or configurations. Consider using a separate Python installation managed by a tool like pyenv to avoid such issues.
5. (If using an IDE) Check IDE configurations:

SAM CLI settings: If you're using an IDE with SAM CLI integration, check its settings for any configurations related to SAM CLI, Python environments, or dependency management.
Disable conflicting plugins: Disable any plugins or extensions that might interfere with SAM CLI or watchdog.

@sidhujus
Copy link
Contributor

Hey @keeano92, @914005, Thanks for reporting this issue! Could you try uninstalling SAM CLI and installing it again with our installers published here on the github and see if that fixes your issue? Ill look into reproducing this in the meantime

@sidhujus
Copy link
Contributor

I am able to reproduce the issue when installing sam through pip, but it works fine when installed through our published installers.

@sidhujus sidhujus added stage/needs-investigation Requires a deeper investigation area/sync sam sync command and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Oct 22, 2024
@keeano92
Copy link

@sidhujus I have done as you instructed, I uninstalled sam locally and from pip. I then installed using the MSI package and restarted VSCode so its terminal would restart. I Ran sam --version to make sure it had installed correctly and again, I am looking at this error:
`2024-10-22 14:46:33,978 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2024-10-22 14:46:34,129 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

Error: BaseObserver.schedule() takes 3 positional arguments but 4 were given
Traceback:
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\cli_config_file.py", line 347, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 185, in wrapped
raise exception # pylint: disable=raising-bad-type
^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 150, in wrapped
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\event.py", line 376, in wrapped
raise exception
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\event.py", line 368, in wrapped
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\cli_validation\image_repository_validation.py", line 111, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 104, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\version_checker.py", line 43, in wrapped
actual_result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\main.py", line 95, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\cdk_support_decorators.py", line 40, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\command_exception_handler.py", line 89, in wrapper_command_exception_handler
raise ex
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\command_exception_handler.py", line 69, in wrapper_command_exception_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 229, in cli
do_cli(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 411, in do_cli
execute_watch(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 572, in execute_watch
watch_manager.start()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 230, in start
self._start()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 245, in _start
self._execute_infra_sync(first_sync)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 280, in _execute_infra_sync
self._add_template_triggers()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 186, in _add_template_triggers
self._observer.schedule_handlers(template_trigger.get_path_handlers())
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\path_observer.py", line 153, in schedule_handlers
watches.append(self.schedule_handler(path_handler))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\path_observer.py", line 170, in schedule_handler
watch: ObservedWatch = self.schedule(path_handler.event_handler, str(path_handler.path), path_handler.recursive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

An unexpected error was encountered while executing "sam sync".`

@keeano92
Copy link

I am getting errors now too for sam deploy guided, about pip packages. I am going to have to uninstall sam-cli the way you suggested and do it through pip to get my deploys up.

@keeano92
Copy link

i did a modify>repair and deploy is working again. I am also going to try sync after

@keeano92
Copy link

@sidhujus So Sam sync still does not work and provides the same error on my end, Ref:
`2024-10-22 16:17:55,349 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)
2024-10-22 16:17:55,473 | HTTPSConnectionPool(host='aws-serverless-tools-telemetry.us-west-2.amazonaws.com', port=443): Read timed out. (read timeout=0.1)

Error: BaseObserver.schedule() takes 3 positional arguments but 4 were given
Traceback:
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\cli_config_file.py", line 347, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\decorators.py", line 92, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 185, in wrapped
raise exception # pylint: disable=raising-bad-type
^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 150, in wrapped
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\event.py", line 376, in wrapped
raise exception
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\event.py", line 368, in wrapped
return_value = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\cli_validation\image_repository_validation.py", line 111, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\telemetry\metric.py", line 104, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\version_checker.py", line 43, in wrapped
actual_result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\cli\main.py", line 95, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\cdk_support_decorators.py", line 40, in wrapped
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\command_exception_handler.py", line 89, in wrapper_command_exception_handler
raise ex
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands_utils\command_exception_handler.py", line 69, in wrapper_command_exception_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 229, in cli
do_cli(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 411, in do_cli
execute_watch(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\commands\sync\command.py", line 572, in execute_watch
watch_manager.start()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 230, in start
self._start()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 245, in _start
self._execute_infra_sync(first_sync)
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 285, in _execute_infra_sync
self._start_sync()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 253, in _start_sync
self._add_template_triggers()
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\sync\watch_manager.py", line 186, in _add_template_triggers
self._observer.schedule_handlers(template_trigger.get_path_handlers())
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\path_observer.py", line 153, in schedule_handlers
watches.append(self.schedule_handler(path_handler))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\samcli\lib\utils\path_observer.py", line 170, in schedule_handler
watch: ObservedWatch = self.schedule(path_handler.event_handler, str(path_handler.path), path_handler.recursive)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

An unexpected error was encountered while executing "sam sync".`

@harunhasdal
Copy link

Received the same error above while running "The Complete AWS SAM Workshop". With both commands specified below:

SAM CLI, version 1.126.0

sam sync --watch --build-image amazon/aws-sam-cli-build-image-python3.11 --use-container --stack-name sam-app

or

sam sync --watch --stack-name sam-app

@Leigh-M
Copy link

Leigh-M commented Oct 24, 2024

Same issue for me, upgraded Ubuntu to 24.04.1 LTS (Python 3.12.3)

Clean re-install of all software including SAM. sam sync runs fine but sam sync --watch throws: Error: BaseObserver.schedule() takes 3 positional arguments but 4 were given. Impacting work.

Uninstalled SAM and fresh install from AWS: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html issue not resolved by re-installing

@stephenVertex
Copy link

Seeing the same issue on macOS.

@hnnasit
Copy link
Contributor

hnnasit commented Oct 28, 2024

It looks like the issue is coming from the watchdog version bump to 5.0.3. The team is actively working on the fix. Please use the previous version SAM CLI 1.125.0 as a workaround while the team works on getting the fix out.

@lArtiquel
Copy link

lArtiquel commented Oct 29, 2024

Same issue on Mac Ventura 13.6.9
Python 3.13.0
SAM CLI, version 1.126.0

Traceback:
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/cli/cli_config_file.py", line 347, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/telemetry/metric.py", line 185, in wrapped
    raise exception  # pylint: disable=raising-bad-type
    ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/telemetry/metric.py", line 150, in wrapped
    return_value = func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/telemetry/event.py", line 376, in wrapped
    raise exception
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/telemetry/event.py", line 368, in wrapped
    return_value = func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/cli_validation/image_repository_validation.py", line 111, in wrapped
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/telemetry/metric.py", line 104, in wrapped
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/utils/version_checker.py", line 43, in wrapped
    actual_result = func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/cli/main.py", line 95, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/_utils/cdk_support_decorators.py", line 40, in wrapped
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/_utils/command_exception_handler.py", line 89, in wrapper_command_exception_handler
    raise ex
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/_utils/command_exception_handler.py", line 69, in wrapper_command_exception_handler
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/sync/command.py", line 229, in cli
    do_cli(
    ~~~~~~^
        template_file,
        ^^^^^^^^^^^^^^
    ...<28 lines>...
        watch_exclude,
        ^^^^^^^^^^^^^^
    )  # pragma: no cover
    ^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/sync/command.py", line 411, in do_cli
    execute_watch(
    ~~~~~~~~~~~~~^
        template=template_file,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        watch_exclude=watch_excludes_filter,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/commands/sync/command.py", line 572, in execute_watch
    watch_manager.start()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/sync/watch_manager.py", line 230, in start
    self._start()
    ~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/sync/watch_manager.py", line 245, in _start
    self._execute_infra_sync(first_sync)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/sync/watch_manager.py", line 285, in _execute_infra_sync
    self._start_sync()
    ~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/sync/watch_manager.py", line 253, in _start_sync
    self._add_template_triggers()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/sync/watch_manager.py", line 186, in _add_template_triggers
    self._observer.schedule_handlers(template_trigger.get_path_handlers())
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/utils/path_observer.py", line 153, in schedule_handlers
    watches.append(self.schedule_handler(path_handler))
                   ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.126.0_1/libexec/lib/python3.13/site-packages/samcli/lib/utils/path_observer.py", line 170, in schedule_handler
    watch: ObservedWatch = self.schedule(path_handler.event_handler, str(path_handler.path), path_handler.recursive)
                           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

UPD: works if I install sam cli with pip instead of brew.

brew uninstall aws-sam-cli

pip install --upgrade aws-sam-cli

@hnnasit
Copy link
Contributor

hnnasit commented Oct 30, 2024

A fix has been release in SAM CLI version 1.127.0. Please try installing using the docs and let us know if you are still running into issues or have any questions. Closing this ticket.

@hnnasit hnnasit closed this as completed Oct 30, 2024
Copy link
Contributor

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

@Leigh-M
Copy link

Leigh-M commented Oct 30, 2024

Thanks @hnnasit yes 1.127.0 resolved the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sync sam sync command type/bug
Projects
None yet
Development

No branches or pull requests

8 participants