opbeat_python icon indicating copy to clipboard operation
opbeat_python copied to clipboard

Problem with proxy, Django and opbeat

Open eliasj opened this issue 9 years ago • 2 comments

Hi, I have problem with opbeat reaching the intake server when running opbeat with Django. With Flask I don't have that problem, both running on the same server/environment.

Proxy is set in environment variables. I added so when opbeat/transport/http.py is loaded, it writes the proxies.

try:
    from urllib2 import Request, urlopen, getproxies                            
    print(getproxies())
except ImportError:                                                             
    from urllib.request import Request, urlopen

dev01:~/Proj/inv> ./manage.py opbeat test {'ftp': 'http://wwwproxy.work.se:808', 'http': 'http://wwwproxy.work.se:808', 'https': 'http://wwwproxy.work.se:808'}

                          .o8                               .
                         "888                             .o8
     .ooooo.  oo.ooooo.   888oooo.   .ooooo.   .oooo.   .o888oo
    d88' `88b  888' `88b  d88' `88b d88' `88b `P  )88b    888
    888   888  888   888  888   888 888ooo888  .oP"888    888
    888   888  888   888  888   888 888    .o d8(  888    888 .
    `Y8bod8P'  888bod8P'  `Y8bod8P' `Y8bod8P' `Y888""8o   "888"
               888
              o888o

Trying to send a test error to Opbeat using these settings:

ORGANIZATION_ID: [....] APP_ID: [....] SECRET_TOKEN: [....] SERVERS: https://intake.opbeat.com

ERROR Unable to reach Opbeat server: (url: https://intake.opbeat.com/api/v1/organizations/[....]/apps/[....]/errors/) None ERROR Failed to submit message: u'OpbeatTestException: Hi there!'

Is there anything I need to configure or missed to test?

eliasj avatar Feb 23 '16 13:02 eliasj

Hi Elias

This sounds like a bug. Thanks for reporting, we'll investigate! In the meantime (and if your proxy server supports it), could you check if it helps to set the HTTPS_PROXY environment variable to https://wwwproxy.work.se:808 (probably a different port)?

beniwohli avatar Feb 23 '16 14:02 beniwohli

Not sure if it's related, but I'm having this error message when sending a test exception:

ERROR HTTP 400:  
ERROR Failed to submit message: 'OpbeatTestException: Hi there!' 

python manage.py opbeat check returns everything ok:

Organization, app and secret token are set, good job!

DEBUG mode is disabled! Looking good!

Opbeat APM middleware not set!

Add it to your MIDDLEWARE_CLASSES like this:

    MIDDLEWARE_CLASSES = (
        "opbeat.contrib.django.middleware.OpbeatAPMMiddleware",
        # your other middleware classes
    )

Looks like everything should be ready!

smaniotto avatar Dec 15 '17 17:12 smaniotto