1

I have added the proxy with an n.p.m installation. However, when I run my app locally it shows this error:

tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 80

What could be the problem? Is it that my added proxy is wrong or is there something else? If it is the former issue, please give me the steps to fix it. Thank you in advance.

RumbleBee
  • 25
  • 4
  • Please show us the code you are trying and the exact error output you are seeing. – Alex da Silva Jan 15 '16 at 12:59
  • The error in the web browser after running app locally is "Oops, something went wrong... tunneling socket could not be established, cause=getaddrinfo ENOTFOUND 80" and code is var credentials = extend({ version: 'v1', url: 'https://gateway.watsonplatform.net/tradeoff-analytics/api', username: '*My username', password: 'My Password' }, bluemix.getServiceCreds('tradeoff_analytics')); // VCAP_SERVICES // Create the service wrapper var tradeoffAnalytics = watson.tradeoff_analytics(credentials); – RumbleBee Jan 19 '16 at 06:11

2 Answers2

1

I understand you're trying to use the Tradeoff Analytics service. If all you need is a simple proxy, which does not do anything other than forward the \dilemma calls to the service, you might want to consider using the simplified proxy from the new UI's demo page. With this proxy, it's basically a two-liner to set-up a proxy.

To do that, please go to our GitHub project. Here are the steps you need to do in order to use the simple proxy:

  1. Add "http-proxy-middleware": "^0.9.0" to your package.json (this is the only dependency the simplified proxy needs).
  2. Copy the file tradeoff-analytics-proxy.js from our project.
  3. require it in your app.js - see line 20 in the sample app.js
  4. Run it - it will return an Express "middleware" you'll need to send to app.use() - see line 24.
  5. If you're using the Tradeoff Analytics UI Widget, you will need to change the dilemmaServiceUrl to /tradeoff-analytics-proxy/dilemmas. See line 16 of public/index.js.
Dolev
  • 85
  • 7
0

No need to add a proxy via npm installations. And it definately is the cause for your problem.

It is best to use the app.js provided that essentially acts a proxy for the browser requests to Bluemix

Dudi
  • 2,340
  • 1
  • 24
  • 39