-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Context
When executing a function with zappa.async.run in a non lambda environment an error is raised. This seems to happen due to the fact that zappa tries to run the function in the lambda environment even if it's not in the lambda environment. When using the @task decorator this works as expected since there is a direct invokation of the function if AWS_LAMBDA_FUNCTION_NAME env variable is not present.
Expected Behavior
The function should be invoked directly, without errors, in a non lambda environment.
Actual Behavior
The function fails with error
Invalid type for parameter FunctionName, value: None, type: <class 'NoneType'>, valid types: <class 'str'>
Possible Fix
Change this code:
Line 350 in 4cf80b2
| return ASYNC_CLASSES[service](lambda_function_name=lambda_function_name, |
to
(copied from @task decorator)
if (service in ASYNC_CLASSES) and (lambda_function_name):
send_result = ASYNC_CLASSES[service](lambda_function_name=lambda_function_name,
aws_region=aws_region,
capture_response=capture_response).send(task_path, args, kwargs)
return send_result
else: # For local exexution
return func(*args, **kwargs)
Your Environment
- Zappa version used: 0.47.1
- Operating System and Python version: 3.6
Metadata
Metadata
Assignees
Labels
No labels