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

Commit 3b688ba

Browse files
committed
Modifying the function_exists() call as it seems to not be catching recently installed lambda functions. by calling get_function() instead of list_functions... it seems to work.
1 parent 837b246 commit 3b688ba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

aws_lambda/aws_lambda.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ def function_exists(cfg, function_name):
367367
aws_secret_access_key = cfg.get('aws_secret_access_key')
368368
client = get_client('lambda', aws_access_key_id, aws_secret_access_key,
369369
cfg.get('region'))
370-
functions = client.list_functions().get('Functions', [])
371-
for fn in functions:
372-
if fn.get('FunctionName') == function_name:
373-
return True
374-
return False
370+
try:
371+
client.get_function(FunctionName=function_name)
372+
return True
373+
except botocore.errorfactory.ResourceNotFoundException as e:
374+
return False

0 commit comments

Comments
 (0)