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

Fix AWS Lambda tests #3495

Merged
merged 5 commits into from
Sep 5, 2024
Merged

Fix AWS Lambda tests #3495

merged 5 commits into from
Sep 5, 2024

Conversation

antonpirker
Copy link
Member

AWS changed their Lambda run times, so we no longer have access to the current exception during the init phase of the Lambda function.

I am trying to fix this upstream: aws/aws-lambda-python-runtime-interface-client#172

This PR adds a fall back to the errror json object provided by AWS. This has way less data than a real exception in it, but it is better than nothing.

Fixes #3464

Copy link

codecov bot commented Sep 4, 2024

❌ 6 Tests Failed:

Tests completed Failed Passed Skipped
11557 6 11551 1636
View the top 3 failed tests by shortest run time
tests.integrations.bottle.test_bottle test_500
Stack Traces | 0.065s run time
.../integrations/bottle/test_bottle.py:408: in test_500
    response = client.get("/")
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1131: in get
    return self.open(*args, **kw)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1076: in open
    response = self.run_wsgi_app(request.environ, buffered=buffered)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:945: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1233: in run_wsgi_app
    app_rv = app(environ, start_response)
sentry_sdk/utils.py:1761: in runner
    return sentry_patched_function(*args, **kwargs)
sentry_sdk/integrations/bottle.py:78: in sentry_patched_wsgi_app
    return middleware(environ, start_response)
sentry_sdk/integrations/wsgi.py:114: in __call__
    reraise(*_capture_exception())
sentry_sdk/utils.py:1690: in reraise
    raise value
sentry_sdk/integrations/wsgi.py:110: in __call__
    _sentry_start_response, start_response, transaction
sentry_sdk/integrations/bottle.py:74: in <lambda>
    lambda *a, **kw: old_app(self, *a, **kw),
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1130: in __call__
    return self.wsgi(environ, start_response)
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1125: in wsgi
    start_response('500 INTERNAL SERVER ERROR', headers, sys.exc_info())
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1110: in wsgi
    start_response(response._wsgi_status_line(), response.headerlist, exc_info)
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:993: in _handle
    out = route.call(**args)
sentry_sdk/integrations/bottle.py:122: in wrapped_callback
    raise exception
sentry_sdk/integrations/bottle.py:112: in wrapped_callback
    res = prepared_callback(*args, **kwargs)
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:2024: in wrapper
    rv = callback(*a, **ka)
.../integrations/bottle/test_bottle.py:398: in index
    1 / 0
E   ZeroDivisionError: division by zero
tests.integrations.bottle.test_bottle test_logging
Stack Traces | 0.069s run time
.../integrations/bottle/test_bottle.py:357: in test_logging
    client.get("/")
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1131: in get
    return self.open(*args, **kw)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1076: in open
    response = self.run_wsgi_app(request.environ, buffered=buffered)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:945: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1233: in run_wsgi_app
    app_rv = app(environ, start_response)
sentry_sdk/utils.py:1761: in runner
    return sentry_patched_function(*args, **kwargs)
sentry_sdk/integrations/bottle.py:78: in sentry_patched_wsgi_app
    return middleware(environ, start_response)
sentry_sdk/integrations/wsgi.py:114: in __call__
    reraise(*_capture_exception())
sentry_sdk/utils.py:1690: in reraise
    raise value
sentry_sdk/integrations/wsgi.py:110: in __call__
    _sentry_start_response, start_response, transaction
sentry_sdk/integrations/bottle.py:74: in <lambda>
    lambda *a, **kw: old_app(self, *a, **kw),
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1130: in __call__
    return self.wsgi(environ, start_response)
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1125: in wsgi
    start_response('500 INTERNAL SERVER ERROR', headers, sys.exc_info())
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:1110: in wsgi
    start_response(response._wsgi_status_line(), response.headerlist, exc_info)
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.6-bottle-latest/lib/python3.6................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:993: in _handle
    out = route.call(**args)
sentry_sdk/integrations/bottle.py:122: in wrapped_callback
    raise exception
sentry_sdk/integrations/bottle.py:112: in wrapped_callback
    res = prepared_callback(*args, **kwargs)
.tox/py3.6-bottle-latest/lib/python3.6/site-packages/bottle.py:2024: in wrapper
    rv = callback(*a, **ka)
.../integrations/bottle/test_bottle.py:351: in index
    app.logger.error("hi")
E   AttributeError: 'Bottle' object has no attribute 'logger'
tests.integrations.bottle.test_bottle test_logging
Stack Traces | 0.073s run time
.../integrations/bottle/test_bottle.py:357: in test_logging
    client.get("/")
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:1131: in get
    return self.open(*args, **kw)
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:1076: in open
    response = self.run_wsgi_app(request.environ, buffered=buffered)
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:945: in run_wsgi_app
    rv = run_wsgi_app(self.application, environ, buffered=buffered)
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:1233: in run_wsgi_app
    app_rv = app(environ, start_response)
sentry_sdk/utils.py:1761: in runner
    return sentry_patched_function(*args, **kwargs)
sentry_sdk/integrations/bottle.py:78: in sentry_patched_wsgi_app
    return middleware(environ, start_response)
sentry_sdk/integrations/wsgi.py:114: in __call__
    reraise(*_capture_exception())
sentry_sdk/utils.py:1690: in reraise
    raise value
sentry_sdk/integrations/wsgi.py:107: in __call__
    response = self.app(
sentry_sdk/integrations/bottle.py:74: in <lambda>
    lambda *a, **kw: old_app(self, *a, **kw),
.tox/py3.11-bottle-latest/lib/python3.11/site-packages/bottle.py:1130: in __call__
    return self.wsgi(environ, start_response)
.tox/py3.11-bottle-latest/lib/python3.11/site-packages/bottle.py:1125: in wsgi
    start_response('500 INTERNAL SERVER ERROR', headers, sys.exc_info())
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.11-bottle-latest/lib/python3.11/site-packages/bottle.py:1110: in wsgi
    start_response(response._wsgi_status_line(), response.headerlist, exc_info)
sentry_sdk/integrations/wsgi.py:139: in _sentry_start_response
    return old_start_response(status, response_headers, exc_info)
.tox/py3.11-bottle-latest/lib/python3.11................../site-packages/werkzeug/test.py:1226: in start_response
    raise exc_info[1].with_traceback(exc_info[2])
.tox/py3.11-bottle-latest/lib/python3.11/site-packages/bottle.py:993: in _handle
    out = route.call(**args)
sentry_sdk/integrations/bottle.py:122: in wrapped_callback
    raise exception
sentry_sdk/integrations/bottle.py:112: in wrapped_callback
    res = prepared_callback(*args, **kwargs)
.tox/py3.11-bottle-latest/lib/python3.11/site-packages/bottle.py:2024: in wrapper
    rv = callback(*a, **ka)
.../integrations/bottle/test_bottle.py:351: in index
    app.logger.error("hi")
E   AttributeError: 'Bottle' object has no attribute 'logger'

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@antonpirker antonpirker marked this pull request as ready for review September 4, 2024 14:48
@antonpirker antonpirker merged commit 9fc3bd2 into master Sep 5, 2024
120 of 124 checks passed
@antonpirker antonpirker deleted the antonpirker/fix-aws-lambda-tests branch September 5, 2024 12:51
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
AWS changed their Lambda run times, so we no longer have access to the current exception during the init phase of the Lambda function.

I am trying to fix this upstream: aws/aws-lambda-python-runtime-interface-client#172

This PR adds a fall back to the errror json object provided by AWS. This has way less data than a real exception in it, but it is better than nothing.

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

Successfully merging this pull request may close these issues.

Fix AWS Lambda test suite
2 participants