Zappa: Lambda update fails with ResourceConflictException

Context

Since today the zappa update method fails with the following error:

Downloading and installing dependencies..
Packaging project as zip.
Uploading ***********-1631808391.tar.gz (50.2MiB)..
100% 52.6M/52.6M [00:00<00:00, 101MB/s] 
Uploading handler_***********-1631808473.zip (14.5MiB)..
100% 15.2M/15.2M [00:00<00:00, 43.1MB/s]
Updating Lambda function code..
Updating Lambda function configuration..
Oh no! An error occurred! :(

==============

Traceback (most recent call last):
  File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 2785, in handle
    sys.exit(cli.handle())
  File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 510, in handle
    self.dispatch_command(self.command, stage)
  File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 557, in dispatch_command
    self.update(self.vargs['zip'], self.vargs['no_upload'])
  File "/root/repo/venv/lib/python3.6/site-packages/zappa/cli.py", line 975, in update
    aws_kms_key_arn=self.aws_kms_key_arn,
  File "/root/repo/venv/lib/python3.6/site-packages/zappa/core.py", line 1203, in update_lambda_configuration
    'Mode': 'Active' if self.xray_tracing else 'PassThrough'
  File "/root/repo/venv/lib/python3.6/site-packages/botocore/client.py", line 386, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/root/repo/venv/lib/python3.6/site-packages/botocore/client.py", line 705, 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-********:function:***********

==============

It seems like lambda introduced function states and the state needs to be checked during deployment. https://forums.aws.amazon.com/thread.jspa?messageID=995846&#995846

In the error above this means that the state needs to be checked after Updating Lambda function code and before Updating Lambda function configuration

Is there already a fix for this issue?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

As a workaround, until October 1, you can opt-out. Add to your zappa_settings.json:

"lambda_description": "aws:states:opt-out"

Confirming that updating Zappa to v0.54.1 and troposphere to v3.0 got me past this problem.

image

Both mechanisms work by adding a special string in the “Description” parameter of Lambda functions. You can add this string anywhere in this parameter. You can opt to add it to the prefix or suffix, or set the entire contents of the field. This parameter is processed at create or update in accordance with the requested action.

image

Link: https://aws.amazon.com/pt/blogs/compute/coming-soon-expansion-of-aws-lambda-states-to-all-functions/

Resolved as of v0.54.0 via #992

Thanks, @jcastillejo1! That saved my day!

Here are two prs that should fix this issue: https://github.com/zappa/Zappa/pull/1042 https://github.com/zappa/Zappa/pull/992

Still happens to us as well, using Zappa 0.54.1

Traceback (most recent call last):
  File "/root/project/venv/lib/python3.8/site-packages/zappa/cli.py", line 3415, in handle
    sys.exit(cli.handle())
  File "/root/project/venv/lib/python3.8/site-packages/zappa/cli.py", line 588, in handle
    self.dispatch_command(self.command, stage)
  File "/root/project/venv/lib/python3.8/site-packages/zappa/cli.py", line 641, in dispatch_command
    self.update(
  File "/root/project/venv/lib/python3.8/site-packages/zappa/cli.py", line 1162, in update
    self.lambda_arn = self.zappa.update_lambda_configuration(
  File "/root/project/venv/lib/python3.8/site-packages/zappa/core.py", line 1417, in update_lambda_configuration
    response = self.lambda_client.update_function_configuration(**kwargs)
  File "/root/project/venv/lib/python3.8/site-packages/botocore/client.py", line 391, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/root/project/venv/lib/python3.8/site-packages/botocore/client.py", line 719, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.ServiceException: An error occurred (ServiceException) when calling the UpdateFunctionConfiguration operation (reached max retries: 4): An error occurred and the request cannot be processed.

Hey I am facing the same issue.