alexwhitman / node-pushbullet-api

PushBullet API module for Node.js
165 stars 36 forks source link

HTTP proxy support #34

Closed bouchezb closed 6 years ago

bouchezb commented 6 years ago

Hi i try to use the module behind an http proxy. I get this error :

2018-01-05 16:42:24 [10744] [error]:    uncaughtException: connect ETIMEDOUT 216.58.208.211:443
Error: connect ETIMEDOUT 216.58.208.211:443
    at Object._errnoException (util.js:999:13)
    at _exceptionWithHostPort (util.js:1020:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1207:14) {
  "error": {
    "errno": "ETIMEDOUT",
    "code": "ETIMEDOUT",
    "syscall": "connect",
    "address": "216.58.208.211",
    "port": 443
  },
  "stack": "Error: connect ETIMEDOUT 216.58.208.211:443\n    at Object._errnoException (util.js:999:13)\n    at _exceptionWithHostPort (util.js:1020:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1207:14)"

On the request module page i can see that i can override defaults.

var r = request.defaults({'proxy':'http://localproxy.com'})

How can i use it with node-pushbullet-api ?

simonporter007 commented 6 years ago

Until it's added, have you tried using environment variables? From the request documentation it states:

The following environment variables are respected by request:

HTTP_PROXY / http_proxy HTTPS_PROXY / https_proxy NO_PROXY / no_proxy When HTTP_PROXY / http_proxy are set, they will be used to proxy non-SSL requests that do not have an explicit proxy configuration option present. Similarly, HTTPS_PROXY / https_proxy will be respected for SSL requests that do not have an explicit proxy configuration option.

alexwhitman commented 6 years ago

I would say that the environment variable method is good enough rather than adding code to the package.