AttributeError: 'NoneType' object has no attribute 'update' in Django client when using Zappa
Python: 3.6 Django: 2.0.5 Raven: 6.8.0
When running manage.py raven test I get the following.
Client configuration:
base_url : https://sentry.io
project : ***
public_key : ***
secret_key : ***
Sending a test message... 'NoneType' object has no attribute 'update': AttributeError
Traceback (most recent call last):
File "/var/task/handler.py", line 509, in lambda_handler
return LambdaHandler.lambda_handler(event, context)
File "/var/task/handler.py", line 240, in lambda_handler
return handler.handler(event, context)
File "/var/task/handler.py", line 376, in handler
management.call_command(*event['manage'].split(' '))
File "/var/task/django/core/management/__init__.py", line 141, in call_command
return command.execute(*args, **defaults)
File "/var/task/django/core/management/base.py", line 335, in execute
output = self.handle(*args, **options)
File "/var/task/raven/contrib/django/management/commands/raven.py", line 69, in handle
'data': options.get('data'),
File "/var/task/raven/scripts/runner.py", line 81, in send_test_message
'loadavg': get_loadavg(),
File "/var/task/raven/base.py", line 799, in captureMessage
return self.capture('raven.events.Message', message=message, **kwargs)
File "/var/task/raven/contrib/django/client.py", line 279, in capture
data.update(self.get_data_from_request(request))
AttributeError: 'NoneType' object has no attribute 'update'
When raising a dummy exception in a view I see no sentry specific logs and get no events in Sentry.
Are you using Zappa? Had the same issue, fix was...
"transport": "raven.transport.requests.RequestsHTTPTransport" in your RAVEN_CONFIG.
In your zappa_settings.json you want "app_function": "project.wsgi" going to your Django wsgi.py file.
And in wsgi.py you want something like this:
import os
from django.core.wsgi import get_wsgi_application
from raven.middleware import Sentry
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
application = Sentry(get_wsgi_application())
@nickday I am indeed, I'll give the above a try, thanks!
Is this issue pretty new? I just realized sentry was not sending alerts.