Skip to content

Commit cfade12

Browse files
committed
for whatever reason some times list_functions doesn't get all functions, whereas get_function by name seems to work more consistently
1 parent 14857bc commit cfade12

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

aws_lambda/aws_lambda.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ def function_exists(cfg, function_name):
405405
aws_secret_access_key = cfg.get('aws_secret_access_key')
406406
client = get_client('lambda', aws_access_key_id, aws_secret_access_key,
407407
cfg.get('region'))
408-
functions = client.list_functions().get('Functions', [])
409-
for fn in functions:
410-
if fn.get('FunctionName') == function_name:
411-
return True
412-
return False
408+
try:
409+
client.get_function(FunctionaName=function_name)
410+
except:
411+
return False
412+
return True

scripts/lambda

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ def init(folder):
3030
@click.option('--use-requirements', default=False, is_flag=True, help='Install all packages defined in requirements.txt')
3131
@click.option('--local-package', default=None, help='Install local package as well.', type=click.Path(), multiple=True)
3232
@click.option('--raw-copy', default=None, help='directory of stuff to raw copy to the lambda dir', type=click.Path(), multiple=True)
33-
def build(use_requirements, local_package):
34-
aws_lambda.build(CURRENT_DIR, use_requirements, local_package)
33+
def build(use_requirements, local_package, raw_copy):
34+
aws_lambda.build(CURRENT_DIR, use_requirements, local_package, raw_copy)
3535

3636

3737
@click.command(help="Run a local test of your function.")

0 commit comments

Comments
 (0)