lambda-action icon indicating copy to clipboard operation
lambda-action copied to clipboard

ResourceConflictException: … An update is in progress for resource

Open aleon68 opened this issue 3 years ago • 24 comments

We have received for all deploys (new and old lambdas) this error, maybe related to this:

https://forums.aws.amazon.com/thread.jspa?threadID=346005

aleon68 avatar Nov 22 '21 22:11 aleon68

We have received for all deploys (new and old lambdas) this error, maybe related to this:

https://forums.aws.amazon.com/thread.jspa?threadID=346005

We experience the same.

 - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: id
          aws_secret_access_key: key
          aws_region: eu-west-1
          runtime: nodejs14.x
          function_name: #LAMBDA#
          zip_file: lambdas/#LAMBDA#/bundle.zip
          publish: true

2021/11/23 09:00:17 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:eu-west-1:xxxxxxxxxxxxx:function:lambdafunction

{
  RespMetadata: {
    StatusCode: 409,
    RequestID: "93137e18-d549-4074-b7da-3c4ef46fae6f"
  },
  Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:eu-west-1:xxxxxxxxxxxxx:function:lambdafunction",
  Type: "User"
}

gurugutten avatar Nov 23 '21 09:11 gurugutten

This is obviously due to the change described here: https://aws.amazon.com/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

If you specify multiple properties (like image_uri and memory_size) the tool probably internally issues multiple subsequent requests which fail due to the new InProgress status.

marchof avatar Nov 23 '21 09:11 marchof

Yes, Understand that, on my YML, I have multiple updates (description, handler, environments, etc) all of thems was updated without error, but the process fail updating the zip with code.

I Understand the article, but can see how can Solve the error.

El mar., 23 de noviembre de 2021 4:34 a. m., Marc R. Hoffmann < @.***> escribió:

This is obviously due to the change described here: https://aws.amazon.com/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

If you specify multiple properties (like image_uri and memory_size) the tool probably internally issues multiple subsequent requests which fail due to the new InProgress status.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/appleboy/lambda-action/issues/46#issuecomment-976332550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM534HJPMFMR2UQXXD6CCVTUNNN3RANCNFSM5ISDBU6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

aleon68 avatar Nov 23 '21 12:11 aleon68

Sorry, I try Say:

I can't see how solve the error

El mar., 23 de noviembre de 2021 7:34 a. m., Antonio León < @.***> escribió:

Yes, Understand that, on my YML, I have multiple updates (description, handler, environments, etc) all of thems was updated without error, but the process fail updating the zip with code.

I Understand the article, but can see how can Solve the error.

El mar., 23 de noviembre de 2021 4:34 a. m., Marc R. Hoffmann < @.***> escribió:

This is obviously due to the change described here: https://aws.amazon.com/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

If you specify multiple properties (like image_uri and memory_size) the tool probably internally issues multiple subsequent requests which fail due to the new InProgress status.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/appleboy/lambda-action/issues/46#issuecomment-976332550, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM534HJPMFMR2UQXXD6CCVTUNNN3RANCNFSM5ISDBU6A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

aleon68 avatar Nov 23 '21 13:11 aleon68

I've been talking with AWS tech support and this is what they have to say:

"I dug into the CloudTrail events for the Lambda service and found that each ‘UpdateFunctionCode’ call that failed with an ‘update in progress’ message was accompanied by a successful ‘UpdateFunctionConfiguration’ call at the same timestamp [1]. Both of these API calls can create the ‘inProgress’ Lambda State [2]. Please verify if the automated update system calls both of these APIs in quick succession. In this case, a loop to check for the ‘inProgress’ state would need to be implemented for the ‘UpdateFunctionCode’ call to allow a delay for the ‘UpdateFunctionConfiguration’ action to complete."

Is that maybe what's causing the issue? If properties being set in the YML are causing the issue it seems like this is a good place to look to resolve it.

merzikain avatar Nov 24 '21 20:11 merzikain

Have the same issue, watching cloud trail it's trying to create the function besides being already created, and update the code at the same time.

mcuv3 avatar Nov 24 '21 21:11 mcuv3

I have the same issue , cloud trail shows updatefunctionconfiguration and updatefunctioncode both events triggered at the same time.

Ankit05012019 avatar Nov 25 '21 08:11 Ankit05012019

same thing here, hopefully this repo is still properly managed. @appleboy @szunami @filipebarros @DmytroSH

ogohogo avatar Nov 26 '21 19:11 ogohogo

The only way to work around this issue currently is to remove all the properties that cause an UpdateFunctionConfiguration API call to AWS. https://docs.aws.amazon.com/lambda/latest/dg/API_UpdateFunctionConfiguration.html

In my case, I had to comment out the description field and it went through.

kevouellet avatar Nov 29 '21 23:11 kevouellet

I noticed there is an open PR on the upstream repo that contains the logic: https://github.com/appleboy/drone-lambda/pull/12, I think if that was merged and this repo pointed to the new version it would be fixed.

jaypeedevlin avatar Nov 30 '21 18:11 jaypeedevlin

I noticed there is an open PR on the upstream repo that contains the logic: appleboy/drone-lambda#12, I think if that was merged and this repo pointed to the new version it would be fixed.

Can we get some feedback on if this is being handled or if this has been abandoned? Just want to know if I need to just build my own service.

merzikain avatar Dec 01 '21 18:12 merzikain

I was able fix this from comment https://github.com/claudiajs/claudia/issues/226#issuecomment-973321034

i.e update description: "aws:states:opt-out"

example:

name: deploy to lambda
on: [push]
jobs:

  deploy_source:
    name: deploy lambda from source
    runs-on: ubuntu-latest
    steps:
      - name: checkout source code
        uses: actions/checkout@v1
      - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          function_name: gorush
          source: example/index.js
          description: "aws:states:opt-out"

tiwarisuraj9 avatar Dec 08 '21 06:12 tiwarisuraj9

According to this post aws:states:opt-out shouldn't be working as a workaround anymore (as of "October 01 2021 – End of Delayed Update"). 🤷‍♂️

exalted avatar Dec 09 '21 14:12 exalted

Right, but is working

aleon68 avatar Dec 09 '21 14:12 aleon68

Well, actually no, my bad: There's an update at the top of that page:

CleanShot 2021-12-09 at 15 47 15@2x

So, apparently, this should've broken as of only few days… 🙄 Maybe this explains yesterday's AWS outage?! 😛

exalted avatar Dec 09 '21 14:12 exalted

Again you are right, maybe this explain downtime on services

aleon68 avatar Dec 09 '21 16:12 aleon68

Maybe the update was done on services, but the problem persists.

I was doing a test right now, performing a deploy with an existent lambda (previously deployed with aws:states:opt-out label), deleting label and redeploy, and failed the deploy. Restoring the label the deployment finish successfully.

I don't understand the AWS logic, but using the label aws:states:opt-out on lambdas can complete deploy.

aleon68 avatar Dec 09 '21 16:12 aleon68

Starting today, the problem appears again. Before I was solved adding on description of lambda aws:states:opt-out, but now this is not working. Someone can help me?

aleon68 avatar Feb 07 '22 22:02 aleon68

I have the same problem even using "aws:states:opt-out" I have got problems. Does anyone have any ideas? This was already updated since when aws recommended it, it was working, but yesterday it didn't!

marcos-pricefy avatar Feb 09 '22 20:02 marcos-pricefy

Same problem here, would really appreciate a fix soon. We had same error in powershell scripts when calling Publich-LMVersion straight after a call to Update-LMFunctionCode. We fixed it by adding a waiting loop (not shown) in between those calls, with a timeout (not shown), something like:

$getFunctionResponse = Get-LMFunction -FunctionName $FunctionName
if ($getFunctionResponse.Configuration.LastUpdateStatus -eq 'Successful') {
    # continue normal execution here
}

thierrysuzanne-cl avatar Feb 14 '22 17:02 thierrysuzanne-cl

I have the same issue but only on node lambda's.. My go lambda's are deploying fine..

sefasenturk95 avatar Feb 18 '22 19:02 sefasenturk95

Anyone solved this issue? Adding description: "aws:states:opt-out" doesn't work for me unfortuantely.

94929 avatar Aug 29 '22 14:08 94929

FYI; Since then we've migrated to AWS CLI (i.e. aws lambda update-function-code ...)

exalted avatar Aug 29 '22 14:08 exalted

@exalted Thanks for letting me know. So I guess this repository is no longer (actively) maintained then?

94929 avatar Aug 29 '22 15:08 94929

I'm facing this problem in deploy step:

2023/02/10 14:40:33 ResourceConflictException: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:****:function:account-transfers-lambda
{
  RespMetadata: {
    StatusCode: 409,
    RequestID: "11040c97-d69c-43d3-a19a-b"
  },
  Message_: "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:***:***",
  Type: "User"
}

This is my config:

 - name: default deploy
        uses: appleboy/lambda-action@master
        with:
          aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws_region: ${{ secrets.AWS_REGION }}
          function_name: account-transfers-lambda
          zip_file: package/function.zip
          handler: lambda_function.lambda_handler
          runtime: python3.8

erikcc02 avatar Feb 10 '23 14:02 erikcc02

I wouldn't recommend using this package as it doesn't seem to be maintained anymore. I was able to deploy my go function with the aws-actions/setup-sam@v1 action.

samdelong avatar Mar 30 '23 16:03 samdelong

I will take it.

appleboy avatar Mar 31 '23 00:03 appleboy

I wouldn't recommend using this package as it doesn't seem to be maintained anymore. I was able to deploy my go function with the aws-actions/setup-sam@v1 action.

How can I apply this action? I could use same yml or need other configuration? Sorry by ask about that, I'm not expert on deploy with github actions

aleon68 avatar Mar 31 '23 17:03 aleon68

fix in https://github.com/appleboy/lambda-action/releases/tag/v0.1.6

appleboy avatar Apr 01 '23 08:04 appleboy

Hello @appleboy , it's still not working on my end.

jjlabajo avatar Apr 01 '23 14:04 jjlabajo