Gunty
Gunty

Reputation: 2489

AWS SAM Deploy error - Validation Error | CreateChangeSet Operation Error

I get the following error upon attempting to sam deploy --guided my lambda application.

Error: Failed to create changeset for the stack: {stack-name}, An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack:arn:aws:cloudformation:ap-southeast-2:014009325916:stack/{stack-name}/f2212bf0-bb41-11ea-8ef3-0aa7af0536b6 is in ROLLBACK_COMPLETE state and can not be updated.

Some further context into this issue is that all of my lambda functions do not have authorization defined. Not sure if that is related but I'm stating it in the case that it is.

I frankly have no idea how to go about this issue. Any help is appreciated.

===

Context: Building an automated trading system

Request for Cloudformation Template:

yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: A tradingview alert wrapper that interprets alerts and makes trades according to them.

Globals:
    Function:
        # CodeUri: function/.
        # Runtime: python3.8
        # Policies:
        #     - AWSLambdaFullAccess
        # Tracing: Active
        # Timeout: 30
        Environment:
            Variables:
                APIKEY: ""
                SECRETKEY: ""


Resources:
    tradeFunction:
        Type: AWS::Serverless::Function
        Properties:
            Handler: app.trade
            Description: The primary execution function
            CodeUri: function/.
            Runtime: python3.8
            Policies:
                - AWSLambdaFullAccess
            Tracing: Active
            Timeout: 60
            Events:
                inputResponse:
                    Type: Api
                    Auth:
                        ApiKeyRequired: false
                        Authorizer: NONE
                    Properties:
                        Path: /trade
                        Method: post
                        

    printAccountBalanceFunction:
        Type: AWS::Serverless::Function
        Properties:
            CodeUri: function/.
            Runtime: python3.8
            Policies:
                - AWSLambdaFullAccess
            Tracing: Active
            Timeout: 30
            Handler: app.print_account_balance
            Description: Returns account balance over time or trade
            Events:
                inputResponse:
                    Type: Api
                    Properties:
                        Path: /print_account_balance
                        Method: get
    startTradesFunction:
        Type: AWS::Serverless::Function
        Properties:
            CodeUri: function/.
            Runtime: python3.8
            Policies:
                - AWSLambdaFullAccess
            Tracing: Active
            Timeout: 30
            Handler: app.start_trades
            Description: Resets trade log for a fresh start
            Events:
                inputResponse:
                    Type: Api
                    Properties:
                        Path: /start_trades
                        Method: get                   
    retrieveTradeLogFunction:
        Type: AWS::Serverless::Function
        Properties:
            CodeUri: function/.
            Runtime: python3.8
            Policies:
                - AWSLambdaFullAccess
            Tracing: Active
            Timeout: 30
            Handler: app.retrieve_trade_log
            Description: Return all the trade logs in the dyanamoDB database
            Events:
                inputResponse:
                    Type: Api
                    Properties:
                        Path: /retrieve_trade_log
                        Method: get



Upvotes: 5

Views: 7774

Answers (2)

Omar
Omar

Reputation: 179

Might need to run sam build first so your resources can get the latest changes

Upvotes: 0

Gunty
Gunty

Reputation: 2489

The error is encountered to my understanding when one does an initial deployment and that initial deployment fails. As a result of this, something breaks and the deployment service can not execute successfully. To fix this issue, simple delete the aws cloudformation stack and redeploy.

One can use the following command to delete:

aws cloudformation delete-stack --stack-name <insert stack-name>

Reference

Upvotes: 9

Related Questions