Search code examples
pythondjangohaproxysentryraven

Sentry + Raven, HTTP Error 401: UNAUTHORIZED


I have a Sentry application, running correctly on the url: mydomain.com:11011.

I have a project created with the CDN: http://XXX:[email protected]:11011/2

This url is served with HAProxy with this configuration:

listen sentry *:11011
    mode tcp
    server app1 localhost:9005 maxconn 32

The configuration of sentry:

SENTRY_KEY = 'foo'
SENTRY_PUBLIC = True
SENTRY_URL_PREFIX = 'http://mydomain.com:11011'  # No trailing slash!
SENTRY_WEB_HOST = 'localhost'
SENTRY_WEB_PORT = 9005
SENTRY_WEB_OPTIONS = {
    'workers': 1, # the number of gunicorn workers
    'worker_class': 'gevent',
}

But I have a problem with authentication when I try Raven test, from the same server:

$ raven test http://XXX:[email protected]:11011/2
HTTPError: HTTP Error 401: UNAUTHORIZED

Also fails:

$ raven test http://XXX:YYY@localhost:9005/2
HTTPError: HTTP Error 401: UNAUTHORIZED

What could be the problem? Thanks.


Solution

  • The problem was the different versions of raven on the client and server

    In the Sentry server:

    raven==1.8.4
    sentry==4.4.5
    

    In the django application:

    raven==1.9.1
    

    To fix this, do the following, in django application.

    pip uninstall raven
    pip install raven==1.8.4