Search code examples
pythonamazon-web-servicesflaskboto3zappa

Attribute not found for closure


Code

    def zappa_async(func):
        print('here')
        @wraps(func)
        @task(capture_response=True)
        def func_wrap_async(*args, **kwargs):
            return func(*args, **kwargs)

        def func_wrap_async_response_id(*args, **kwargs):
            return func_wrap_async(*args, **kwargs).response_id

        return func_wrap_async_response_id

Expected Behavior

Take a function and return a new function that is asynchronous and returns its response id

Actual Behavior

lambda throws module 'rap_stats.MapReduce' has no attribute 'func_wrap_async': AttributeError

Update

It works when I remove '@task' and '.response_id' but I need these in order for it to properly function asynchronously


Solution

  • The README says:

    To capture responses, you must configure a async_response_table in zappa_settings.

    This needs to be done.