Skip to content
This repository was archived by the owner on Mar 15, 2026. It is now read-only.
This repository was archived by the owner on Mar 15, 2026. It is now read-only.

Lambda deploy : call to update_configuration_function is made before lambda update status is ready #711

Description

@roamdam

Problem

It seems that the application of lambda states to all functions, including zip-file based lambdas, prevents from deploying as previously with lambda deploy. Several lambdas that I was able to deploy perfectly last week do not deploy now.

Error

The error I'm getting is the following

botocore.errorfactory.ResourceConflictException: An error occurred (ResourceConflictException) when calling the UpdateFunctionConfiguration operation: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:eu-west-3:xxx:function:my-lambda

Observations

It seems that right after calling the client.update_function_code method, the LastUpdateStatus from the lambda's configuration stays at InProgress, thus the subsequent call to client.update_function_configuration is refused by the API.

I've tried adding a simple time.sleep(120) right after the call to client.update_function_code, and it seems to work : after waiting the value of LastUpdateStatus goes back to Successful, and the deployment goes fine afterwards.

Activity

  1. changed the title [-]Lambda deploy : call to update_configuration_function is made before lambda update status is ready[/-] [+]Lambda deploy : call to `update_configuration_function` is made before lambda update status is ready[/+] on Nov 26, 2021
  2. Lowess commented on Feb 22, 2022

    @Lowess

    @nficano any chance to get the PR from rashadmoarref approved ? I have been using his fix as well it it is working fine !

    Thanks.

  3. znotdead commented on Apr 19, 2022

    @znotdead

    Sleep looks like hack and what if you are updating many functions in same time? deployment will be very long.
    Possible solutions:

    1. First deploy code and deploy new configuration -> than change status to published in separate command. Haven't tried yet but according docs should work
    2. Much less acceptable is to try fetch status from AWS and when it's published try change config. but after is still need to be published. (Bad solution)
    3. just sleep and hope that AWS updates (but you can not guarantee that in 90 seconds function will be published) so it can fail if AWS degraded anyway.

    I think we need to go by way 1 so there will be no delays in deployments and guarantee that status changes after all changes are done. PR above can be used as temp fix and can work but not in 100% times and makes deployments much longer!

  4. znotdead commented on Apr 19, 2022

    @znotdead

    Okay. As everything is async I've used client waiter to make configuration changes during update. PR #716

  5. vorte commented on Sep 20, 2022

    @vorte

    I can see this issue has been resolved in #714 but the latest version available on pip is 11.8.0 from over a year ago. https://pypi.org/project/python-lambda/

    Is it possible to publush a new version please so we can have access to the latest code via pip?

  6. sscovil-techgc commented on Apr 20, 2023

    @sscovil-techgc

    I'm running the latest version 11.8.0 on Python v3.11, and getting the same ResourceConflictException whenever I run:

    lambda deploy \
      --config-file aws_lambda_config.yaml \
      --requirements requirements.txt

    It still uploads the lambda and everything seems to works fine, so it's only a minor nuisance.

    Here is the full traceback:

    Traceback (most recent call last):
      File "/app/.venv/bin/lambda", line 213, in <module>
        cli()
      File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 716, in __call__
        return self.main(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 696, in main
        rv = self.invoke(ctx)
             ^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 1060, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 889, in invoke
        return ctx.invoke(self.callback, **ctx.params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/click/core.py", line 534, in invoke
        return callback(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/bin/lambda", line 117, in deploy
        aws_lambda.deploy(
      File "/app/.venv/lib/python3.11/site-packages/aws_lambda/aws_lambda.py", line 138, in deploy
        update_function(
      File "/app/.venv/lib/python3.11/site-packages/aws_lambda/aws_lambda.py", line 744, in update_function
        ret = client.update_function_configuration(**kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/botocore/client.py", line 530, in _api_call
        return self._make_api_call(operation_name, kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/app/.venv/lib/python3.11/site-packages/botocore/client.py", line 960, in _make_api_call
        raise error_class(parsed_response, operation_name)
    botocore.errorfactory.ResourceConflictException: An error occurred (ResourceConflictException) when calling the UpdateFunctionConfiguration operation: The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:us-east-1:012345678901:function:my_lambda
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions