How to resolve error "ROLLBACK_COMPLETE" in deploy stage of code pipeline?

0

I'm trying to Setting up CI/CD for Lambda Functions using AWS CodePipeline+GitHub+CloudFormation CICD Architecture but I'm facing CodeUri error between Default artifact store bucket and cloudFormation.

I have created lambda function locally and cloned it with github repository. github repositoryThen I created code pipeline and in deploy stage I have configured the stack with template file function.yml with syntax:

AWSTemplateFormatVersion: "2010-09-09" Transform: AWS::Serverless-2016-10-31 Resources: SampleLambdaFunction: Type: AWS::Serverless::Function Properties: CodeUri: . # Directory where the source file is located FunctionName: cicd_testing_by_ahmad Handler: index.handler Runtime: nodejs 14.x

but I'm facing an error

  • "Stack:arn:aws:cloudformation:us-east-1:747******** stack/CiCdByAhmed/a27c5c50-97e8-************ is in ROLLBACK_COMPLETE state and can not be updated. (Service: AmazonCloudFormation; Status Code: 400; Error Code: ValidationError; Request ID: d9ea93a1-9aff-4e74-9e9a-*********; Proxy: null)". error

  • I searched on this error in cloudFormation and find the reason "Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [SampleLam bdaFunction] is invalid. 'CodeUri' is not a valid S3 Uri of the form 's3://bucket/key' with optional versionId query parameter.. Rollback requested by user."

But I cannot set CodeUri manually to 's3://bucket/key' because when we push our code new object file created in S3 automatically and CodeUri is updated itself. And we have multiple objects(files) and we have to pick up the latest one but in my case it's not working correct. cloud formation template Explain how can I resolve this issue.

1 個回答
0

Execute the following AWS CLI command to delete your stack:

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

and then try to redeploy it.

This actually happens when stack creation fails. By default the stack will remain in a status of ROLLBACK_COMPLETE. It means it's successfully rolled back or deleted all the resources which the stack had created. But you have to delete the empty stack itself. You cannot update this stack automatically. You should manually delete it, after which you can attempt to deploy it again.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stack-failure-options.html#stack-failure-options-conditions

profile picture
已回答 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南