moto: Connection error while testing get_function_policy() with mock_lambda

Try running get_function_policy() in moto/tests/test_awslambda/test_lambda.py. Here is my traceback:

Traceback (most recent call last):
  File "moto_test.py", line 722, in <module>
    get_function_policy()
  File "/env/lib/python2.7/site-packages/moto/core/models.py", line 70, in wrapper
    result = func(*args, **kwargs)
  File "moto_test.py", line 708, in get_function_policy
    Qualifier='2'
  File "/env/lib/python2.7/site-packages/botocore/client.py", line 312, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/env/lib/python2.7/site-packages/botocore/client.py", line 588, in _make_api_call
    operation_model, request_dict)
  File "/env/lib/python2.7/site-packages/botocore/endpoint.py", line 141, in make_request
    return self._send_request(request_dict, operation_model)
  File "/env/lib/python2.7/site-packages/botocore/endpoint.py", line 170, in _send_request
    success_response, exception):
  File "/env/lib/python2.7/site-packages/botocore/endpoint.py", line 249, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "/env/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/env/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 269, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "/env/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
requests.exceptions.ConnectionError: Connection refused: POST https://lambda.us-west-2.amazonaws.com/2015-03-31/functions/testFunction/policy?Qualifier=2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I believe that was fixed in the release mentioned above.

I’ve just realized the current master as Moto 1.1.22. Hopefully this clears up some confusion!

@dbfr3qs ahh…thanks, now I get it, it does not rewrite the url so it tries to connect to the real endpoint. Just logged https://github.com/spulec/moto/issues/1254 so this will make more sense later 😃