The update_function_configuration currently returns an empty dict no matter what but certain lambda libraries (ie, Zappa) require a realistic return value... which is simply the current config after being updated.

https://github.com/localstack/localstack/blob/9cba1010dfcbf2b7672df4d7da46b7e8ab287f64/localstack/services/awslambda/lambda_api.py#L872

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.update_function_configuration

There might also be some other magic enriching that result but my quick read-through looks like it's an empty dict.



<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->
def _run_forward_to_fallback_url(self, url, num_requests=3):
        lambda_client = aws_stack.connect_to_service('lambda')
        config.LAMBDA_FALLBACK_URL = url
        try:
            for i in range(num_requests):
                lambda_client.invoke(FunctionName='non-existing-lambda-%s' % i,
                    Payload=b'{}', InvocationType='RequestResponse')
        finally:
            config.LAMBDA_FALLBACK_URL = ''
    def test_add_lambda_permission(self):
        iam_client = aws_stack.connect_to_service('iam')
        lambda_client = aws_stack.connect_to_service('lambda')
        
        action = 'lambda:InvokeFunction'
        resp = lambda_client.add_permission(FunctionName=TEST_LAMBDA_NAME_PY, Action=action,
            StatementId='s3', Principal='s3.amazonaws.com', SourceArn=aws_stack.s3_bucket_arn('test-bucket'))
        self.assertIn('Statement', resp)
        
        policy = lambda_client.get_policy(FunctionName=TEST_LAMBDA_NAME_PY)['Policy']
        self.assertEqual(policy['Statement'][0]['Action'], action)
        self.assertEqual(policy['Statement'][0]['Resource'], lambda_api.func_arn(TEST_LAMBDA_NAME_PY))
        
        policies = iam_client.list_policies(Scope='Local', MaxItems=500)['Policies']
        matching = [p for p in policies if p['PolicyName'] == 'lambda_policy_%s' % TEST_LAMBDA_NAME_PY]
        self.assertEqual(len(matching), 1)
        self.assertIn(':policy/', matching[0]['Arn'])
        
        resp = lambda_client.remove_permission(FunctionName=TEST_LAMBDA_NAME_PY,
            StatementId=resp['Statement'], Qualifier='qual1', RevisionId='r1')
        self.assertEqual(resp['ResponseMetadata']['HTTPStatusCode'], 200)