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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠