- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
Open
Labels
area/syncsam sync commandsam sync commandstage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.Automatically applied to new issues and PRs, indicating they haven't been looked at.
Description
Description:
When running sam sync --stack-name <some-stack> --no-watch --save-params the following error comes up and the stack update fails
Error: can't subtract offset-naive and offset-aware datetimes
Traceback:
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/cli/cli_config_file.py", line 366, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/lib/telemetry/metric.py", line 190, in wrapped
    raise exception  # pylint: disable=raising-bad-type
    ^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/lib/telemetry/metric.py", line 155, in wrapped
    return_value = func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/lib/telemetry/event.py", line 382, in wrapped
    raise exception
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/lib/telemetry/event.py", line 374, in wrapped
    return_value = func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/site-packages/samcli/lib/telemetry/metric.py", line 109, in wrapped
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/site-packages/samcli/cli/main.py", line 95, in wrapper
    return func(*args, **kwargs)
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/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.145.2/libexec/lib/python3.14/site-packages/samcli/commands/sync/command.py", line 432, in do_cli
    infra_sync_result = execute_infra_contexts(
        build_context, package_context, deploy_context, sync_context
    )
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/commands/sync/command.py", line 475, in execute_infra_contexts
    return infra_sync_executor.execute_infra_sync(first_sync=True)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/aws-sam-cli/1.145.2/libexec/lib/python3.14/site-packages/samcli/lib/sync/infra_sync_executor.py", line 176, in execute_infra_sync
    days_since_last_infra_sync = (current_time - last_infra_sync_time).days
                                  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
An unexpected error was encountered while executing "sam sync".
Search for an existing issue:
https://github.com/aws/aws-sam-cli/issues?q=is%3Aissue+is%3Aopen+Bug%3A%20sam%20sync%20-%20TypeError
Or create a bug report:
https://github.com/aws/aws-sam-cli/issues/new?template=Bug_report.md&title=Bug%3A%20sam%20sync%20-%20TypeError
Steps to reproduce:
Run sam sync --stack-name <some-stack> --no-watch --save-params.
Observed result:
See description above
Expected result:
A stack update
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
{
  "version": "1.145.2",
  "system": {
    "python": "3.14.0",
    "os": "macOS-15.6.1-arm64-arm-64bit-Mach-O"
  },
  "additional_dependencies": {
    "container_engine": "Docker(v28.5.1)",
    "aws_cdk": "Not available",
    "terraform": "1.13.3"
  },
  "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
Labels
area/syncsam sync commandsam sync commandstage/needs-triageAutomatically applied to new issues and PRs, indicating they haven't been looked at.Automatically applied to new issues and PRs, indicating they haven't been looked at.