Deniz
Deniz

Reputation: 1565

AWS "sam deploy" function times out. Stack stays in "REVIEW_IN_PROGRESS" status

I'm trying to deploy a very simple function as shown in below template.yaml file. It creates a "samcli-deploy1629444458" changeset and it stays in "CREATE_IN_PROGRESS" status. When I check details of it there is no changes in it. There is nothing in Events, Resources, Output sections of the stack too. "sam deploy" command fails with attached output and stack stays in "REVIEW_IN_PROGRESS" status and I need to manually delete it.

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
  AWS Test backend.


Globals:
  Function:
    Timeout: 3
    Runtime: nodejs12.x

Resources:
  HelloWorldApi:
    Type: AWS::Serverless:Api
    Properties:
      Name:API
      StageName: Prod

  HelloWorldFunction:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: hello-world/
      Handler: app.lambdaHandler
      Events:
        HelloWorld:
          Type: Api 
          Properties:
            RestApiId: !Ref HelloWorldApi
            Path: /hello
            Method: get

Output of "sam deploy" command.

Waiting for changeset to be created..
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/deploy/deployer.py", line 292, in wait_for_changeset
    waiter.wait(ChangeSetName=changeset_id, StackName=stack_name, WaiterConfig=waiter_config)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/botocore/waiter.py", line 53, in wait
    Waiter.wait(self, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/botocore/waiter.py", line 362, in wait
    raise WaiterError(
botocore.exceptions.WaiterError: Waiter ChangeSetCreateComplete failed: Max attempts exceeded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/sam", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/cli_validation/image_repository_validation.py", line 76, in wrapped
    return func(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 153, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 122, in wrapped
    return_value = func(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/utils/version_checker.py", line 42, in wrapped
    actual_result = func(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/cli/main.py", line 90, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/commands/deploy/command.py", line 206, in cli
    do_cli(
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/commands/deploy/command.py", line 345, in do_cli
    deploy_context.run()
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/commands/deploy/deploy_context.py", line 155, in run
    return self.deploy(
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/commands/deploy/deploy_context.py", line 229, in deploy
    result, changeset_type = self.deployer.create_and_wait_for_changeset(
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/deploy/deployer.py", line 458, in create_and_wait_for_changeset
    self.wait_for_changeset(result["Id"], stack_name)
  File "/usr/local/Cellar/aws-sam-cli/1.28.0/libexec/lib/python3.8/site-packages/samcli/lib/deploy/deployer.py", line 297, in wait_for_changeset
    reason = resp["StatusReason"]
KeyError: 'StatusReason'

execution-status-not-available

Update: If I wait long enough after "sam deploy" command failed and not manually delete the stack, it finally fails with following error:

 1 validation error detected: Value '[AWS::Serverless:Api, AWS::IAM::Role, AWS::Lambda::Function, AWS::Lambda::Permission]' at 'typeNameList' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 204, Member must have length greater than or equal to 10, Member must satisfy regular expression pattern: [A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}::[A-Za-z0-9]{2,64}(::MODULE){0,1}]

I couldn't find any long name in the .yaml file which may cause this error.

Upvotes: 3

Views: 2517

Answers (1)

stijndepestel
stijndepestel

Reputation: 3564

It's a simple typo, you're missing a colon:

Type: AWS::Serverless:Api

Should be

Type: AWS::Serverless::Api

Upvotes: 13

Related Questions