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: Waiter ChangeSetCreateComplete failed #4627

Closed
LorhanSohaky opened this issue Jan 27, 2023 · 8 comments
Closed

Bug: Waiter ChangeSetCreateComplete failed #4627

LorhanSohaky opened this issue Jan 27, 2023 · 8 comments
Labels
area/deploy sam deploy command stage/needs-investigation Requires a deeper investigation type/ux

Comments

@LorhanSohaky
Copy link

Description:

I created a step function that uses functions written in Python and Javascript.

When executing the deploy script, it was stuck for several minutes and generated the error.

botocore.exceptions.WaiterError: Waiter ChangeSetCreateComplete failed: Max attempts exceeded

From what I noticed the type of the function is not being validated correctly

Steps to reproduce:

  1. Build the project
sam build -u
  1. Deploy the project
sam package \
    --template-file template.yaml \
    --output-template-file cloudformation.yaml \
    --image-repository $IMAGE_REPOSITORY \
    --s3-bucket $S3_ARTIFACTS_BUCKET \
    --s3-prefix $S3_ARTIFACTS_PREFIX

sam deploy \
    --template-file cloudformation.yaml \
    --stack-name $AWS_STACK_NAME \
    --capabilities CAPABILITY_IAM \
    --parameter-overrides ${SAM_PARAMETERS} \
    --image-repository $IMAGE_REPOSITORY \
    --debug

A simplified template.yml

AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: My description

Parameters:
  Stage:
    Type: String
    Description: Stage
    ConstraintDescription: Must specify.

Resources:
  MyFunction:
    Type: AWS::Serverless:::Function
    Properties:
      FunctionName: !Sub "MyFunction-Function-${Stage}"
      Description: My Description
      Timeout: 900
      MemorySize: 1769
      PackageType: Image
      Tags:
        project:deploy-stage: !Ref Stage
      Environment:
        Variables:
          ENV: !Ref Stage
      Policies:
        - AmazonS3FullAccess
    Metadata:
      Dockerfile: ./Dockerfile
      DockerContext: .
      DockerTag: my-tag
      DockerBuildArgs:
        FUNCTION_DIR: my_function_1

Observed result:

Initiating deployment
=====================
2023-01-27 15:54:43,159 | Collected default values for parameters: {}
2023-01-27 15:54:43,185 | Sam customer defined id is more priority than other IDs. Customer defined id for resource MyFunction is MyFunction

# removed some lines to not expose any sensitive data

Waiting for changeset to be created..
Traceback (most recent call last):
  File "samcli/lib/deploy/deployer.py", line 305, in wait_for_changeset
  File "botocore/waiter.py", line 53, in wait
  File "botocore/waiter.py", line 365, in wait
botocore.exceptions.WaiterError: Waiter ChangeSetCreateComplete failed: Max attempts exceeded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "samcli/__main__.py", line 12, in <module>
  File "click/core.py", line 829, in __call__
  File "click/core.py", line 782, in main
  File "click/core.py", line 1259, in invoke
  File "click/core.py", line 1066, in invoke
  File "click/core.py", line 610, in invoke
  File "samcli/lib/cli_validation/image_repository_validation.py", line 92, in wrapped
  File "click/decorators.py", line 73, in new_func
  File "click/core.py", line 610, in invoke
  File "samcli/lib/telemetry/metric.py", line 166, in wrapped
  File "samcli/lib/telemetry/metric.py", line 124, in wrapped
  File "samcli/lib/utils/version_checker.py", line 41, in wrapped
  File "samcli/cli/main.py", line 87, in wrapper
  File "samcli/commands/_utils/cdk_support_decorators.py", line 38, in wrapped
  File "samcli/commands/deploy/command.py", line 193, in cli
  File "samcli/commands/deploy/command.py", line 319, in do_cli
  File "samcli/commands/deploy/deploy_context.py", line 175, in run
  File "samcli/commands/deploy/deploy_context.py", line 252, in deploy
  File "samcli/lib/deploy/deployer.py", line 479, in create_and_wait_for_changeset
  File "samcli/lib/deploy/deployer.py", line 310, in wait_for_changeset
KeyError: 'StatusReason'
[31951] Failed to execute script __main__

Expected result:

It was expected to return some error, since there is a typo in the function type.

Type: AWS::Serverless:::Function should be Type: AWS::Serverless::Function

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

  1. OS:
$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.5 LTS
Release:        20.04
Codename:       focal
  1. sam --version:
$ sam info
{
  "version": "1.37.0"
}
  1. AWS region:
# Paste the output of `sam --info` here
@LorhanSohaky LorhanSohaky added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Jan 27, 2023
@qingchm
Copy link
Contributor

qingchm commented Jan 30, 2023

Hmmm so you mean this typo in the template caused create_and_wait_for_changeset method call to exceed max retries and error out? Thanks for pointing this out, let me try to do the same deployment and see if we need to improve on UX/validation here

@qingchm qingchm added type/ux area/deploy sam deploy command stage/needs-investigation Requires a deeper investigation and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Jan 30, 2023
@LorhanSohaky
Copy link
Author

so you mean this typo in the template caused create_and_wait_for_changeset method call to exceed max retries and error out? Thanks for pointing this out, let me try to do the same deployment and see

Exactly

@hawflau
Copy link
Contributor

hawflau commented Jan 30, 2023

Hi @LorhanSohaky can you try with the latest version of SAM CLI (v1.71.0)?
Trying to see if that's still an issue in newer versions of SAM CLI as you were using 1.37.0.

@LorhanSohaky
Copy link
Author

@hawflau, I tested in the latest version (1.71.0) and still with error

@LorhanSohaky
Copy link
Author

Any update? @qingchm @hawflau

@FarrOut
Copy link

FarrOut commented Sep 8, 2023

Seems as though this issue should have been fixed in version 1.78.0. Please correct me if this is not so.

@hnnasit
Copy link
Contributor

hnnasit commented Mar 8, 2024

As @FarrOut pointed out, it seems this is a duplicate of the linked issue which has been fixed and released. Closing this since it's old and fixed, please open a new issue if you still have questions or concerns.

@hnnasit hnnasit closed this as completed Mar 8, 2024
Copy link
Contributor

github-actions bot commented Mar 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy sam deploy command stage/needs-investigation Requires a deeper investigation type/ux
Projects
None yet
Development

No branches or pull requests

5 participants