Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log exception when get_lambda_function_versions fails #639

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michi88
Copy link
Contributor

@michi88 michi88 commented Jan 31, 2017

Description

I propose we at least log the exception here in order for devs to know why it fails.

@coveralls
Copy link

coveralls commented Jan 31, 2017

Coverage Status

Coverage increased (+0.008%) to 81.623% when pulling c90852f on michi88:log_exception_get_versions into b179990 on Miserlou:master.

@Miserlou
Copy link
Owner

Miserlou commented Feb 1, 2017

What happens if you call status on an undeployed function with this?

@michi88
Copy link
Contributor Author

michi88 commented Feb 6, 2017

@Miserlou sorry, didn't notice your comment...

Nothing will be logged to the console in that case unless boto lambda client is unable to authenticate for example.

This will 'fix' the common error we get when using docker to build / use zappa. When a mac sleeps for too long the time is out of sync in docker and boto complains with a handy exception telling you this. But only if we log the message here...

@Miserlou
Copy link
Owner

Miserlou commented Feb 8, 2017

No, I just checked this and it fails as I expected for status:

ERROR:Could not list lambda versions: An error occurred (ResourceNotFoundException) when calling the ListVersionsByFunction operation: Function not found: arn:aws:lambda:us-east-1:123:function:baby-flask-rev
Traceback (most recent call last):
  File "/Users/rjones/Projects/Zappa/lib/Zappa/zappa/zappa.py", line 849, in get_lambda_function_versions
    FunctionName=function_name
  File "/Users/rjones/Projects/Zappa/baby_flask/env/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/rjones/Projects/Zappa/baby_flask/env/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
    raise error_class(parsed_response, operation_name)
ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the ListVersionsByFunction operation: Function not found: arn:aws:lambda:us-east-1:123:function:baby-flask-rev
Error: No Lambda baby-flask-rev detected in us-east-1 - have you deployed yet?

Please update this code to handle ResourceNotFoundExceptions separately, in which case there is no need to log, from other exceptions.

@michi88
Copy link
Contributor Author

michi88 commented Feb 22, 2017

Have been really busy the last 2 weeks. Will fix this in the coming days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants