getsentry / raven-python

Raven is the legacy Python client for Sentry (getsentry.com) — replaced by sentry-python
https://sentry.io
BSD 3-Clause "New" or "Revised" License
1.68k stars 657 forks source link

AWS AppSync BatchInvoke doesn't work with @client.capture_exceptions #1256

Open stickystyle opened 6 years ago

stickystyle commented 6 years ago

If I decorate a function that is called as a BatchInvoke [1] with @client.capture_exceptions, raven will bomb out as it expects the event parameter to be a single item in a dict, when in fact event gets a list of dict's when the lambda is called with BatchInvoke.

Traceback (most recent call last):
File "/var/task/aws_xray_sdk/core/recorder.py", line 359, in wrapper
meta_processor=None,
File "/var/task/aws_xray_sdk/core/recorder.py", line 374, in record_subsegment
return_value = wrapped(*args, **kwargs)
File "/var/task/handler.py", line 60, in graphql_handler
return batch_handler(event, context)
File "/var/task/raven/contrib/awslambda/__init__.py", line 125, in wrapped
self.captureException(event=event, context=context, **kwargs)
File "/var/task/raven/base.py", line 824, in captureException
'raven.events.Exception', exc_info=exc_info, **kwargs)
File "/var/task/raven/contrib/awslambda/__init__.py", line 69, in capture
http_info = self._get_http_interface(event)
File "/var/task/raven/contrib/awslambda/__init__.py", line 147, in _get_http_interface
if event.get('path') and event.get('httpMethod'):
AttributeError: 'list' object has no attribute 'get'

[1] https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers.html#advanced-use-case-batching