无法连接到Sentry日志服务器,错误400

3 投票
1 回答
4168 浏览
提问于 2025-04-16 23:45

当我的 Sentry 客户端尝试记录一个错误时,我遇到了以下错误:

 Unable to reach Sentry log server: HTTP Error 400: BAD REQUEST (url: http://localhost:8000/sentry/store/, body: Missing data)
       Traceback (most recent call last):
         File "/home/deploy/env/lib/python2.6/site-packages/sentry/client/base.py", line 210, in send
           return self.send_remote(url=url, data=message, headers=headers)
         File "/home/deploy/env/lib/python2.6/site-packages/sentry/client/base.py", line 194, in send_remote
           response = urllib2.urlopen(req, data).read()
         File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
           return _opener.open(url, data, timeout)
         File "/usr/lib/python2.6/urllib2.py", line 397, in open
           response = meth(req, response)
         File "/usr/lib/python2.6/urllib2.py", line 510, in http_response
           'http', request, response, code, msg, hdrs)
         File "/usr/lib/python2.6/urllib2.py", line 435, in error
           return self._call_chain(*args)
         File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
           result = func(*args)
         File "/usr/lib/python2.6/urllib2.py", line 518, in http_error_default
           raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
       HTTPError: HTTP Error 400: BAD REQUEST Http 404

它试图记录的错误没有被保存到服务器上。

谢谢!

1 个回答

2

我也遇到过这个问题。

我查看了sentry的代码,找到了抛出400错误的地方(在web/views.py的第424行)。

这个问题发生在一个else语句里,它检查一个叫HTTP_AUTHORIZATION的头信息。为了让这个信息能够通过,我需要在我的apache配置中添加WSGIPassAuthorization On

我觉得我提到的那个else语句可能有个bug,因为这个情况应该被处理的……

撰写回答