Comments (3)
This should be fixed by the options passthrough changes in 1.x. Needs verification
from loopback-connector-cloudant.
Verification steps:
- create a simple http proxy using
http-proxy
module for local cloudant server:
var http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createProxyServer({target:'http://localhost:8080'}).listen(7000);
- modify datasource to point to proxy:
{
"cldntlocal": {
"url": "http://admin:pass@localhost:8080",
"database": "test-db",
"name": "cldntlocal",
"modelIndex": "",
"requestDefault": {
"proxy": "http://admin:pass@localhost:7000"
},
"connector": "cloudant"
}
}
result:
| => DEBUG=loopback:connector:cloudant,cloudant,nano node .
loopback:connector:cloudant Cloudant constructor settings: {"url":"http://admin:pass@localhost:8080","database":"test-db",
"name":"cldntlocal","modelIndex":"","requestDefaults":{"proxy":"http://admin:pass@localhost:7000"},"connector":"cloudant","d
ebug":false} +0ms
loopback:connector:cloudant Cloudant.prototype.connect +4ms
cloudant Initialize +0ms { url: 'http://admin:pass@localhost:8080',
database: 'test-db',
name: 'cldntlocal',
modelIndex: '',
requestDefaults: { proxy: 'http://admin:pass@localhost:7000' },
connector: 'cloudant',
debug: false }
cloudant Create underlying Nano instance, options={"url":"http://admin:pass@localhost:8080","database":"test-db","name":"c
ldntlocal","modelIndex":"","requestDefaults":{"proxy":"http://admin:pass@localhost:7000","agent":{"domain":null,"_events":{}
,"_eventsCount":1,"defaultPort":80,"protocol":"http:","options":{"keepAlive":true,"path":null},"requests":{},"sockets":{},"f
reeSockets":{},"keepAliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256}},"connector":"cloudant","debug
":false} requestDefaults={"proxy":"http://admin:pass@localhost:7000","agent":{"domain":null,"_events":{},"_eventsCount":1,"d
efaultPort":80,"protocol":"http:","options":{"keepAlive":true,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keep
AliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256}} +4ms
cloudant Automatic ping +2ms
nano { method: 'GET', headers: { 'content-type': 'application/json', accept: 'application/json' }, uri: 'http://admin:pass
@localhost:8080/_session' } +3ms
Web server listening at: http://0.0.0.0:3000
Browse your REST API at http://0.0.0.0:3000/explorer
nano { err: null, body: { ok: true, userCtx: { name: 'admin', roles: [Object] }, info: { authentication_db: '_users', auth
entication_handlers: [Object], authenticated: 'default' } }, headers: { date: 'Thu, 01 Jun 2017 19:18:10 GMT', 'content-type
': 'application/json', connection: 'close', 'cache-control': 'must-revalidate', statusCode: 200, uri: 'http://admin:pass@loc
alhost:8080/_session' } } +193ms
nano { method: 'GET', headers: { 'content-type': 'application/json', accept: 'application/json' }, uri: 'http://admin:pass
@localhost:8080' } +1ms
nano { err: null, body: { couchdb: 'Welcome', version: '1.0.0.5-local', vendor: { name: 'Cloudant, an IBM Company', versio
n: '1.0.0.5', variant: 'local' }, features: [ 'geo' ] }, headers: { 'x-couchdb-body-time': '0', 'x-couch-request-id': '4080d
dbd02', date: 'Thu, 01 Jun 2017 19:18:10 GMT', 'content-type': 'application/json', connection: 'close', 'cache-control': 'mu
st-revalidate', statusCode: 200, uri: 'http://admin:pass@localhost:8080' } } +16ms
Tried changing the proxy
key's port to 7001
to verify that it was indeed using it, and got:
| => DEBUG=loopback:connector:cloudant,cloudant,nano node .
loopback:connector:cloudant Cloudant constructor settings: {"url":"http://admin:pass@localhost:8080","database":"test-db",
"name":"cldntlocal","modelIndex":"","requestDefaults":{"proxy":"http://admin:pass@localhost:7001"},"connector":"cloudant","d
ebug":false} +0ms
loopback:connector:cloudant Cloudant.prototype.connect +4ms
cloudant Initialize +0ms { url: 'http://admin:pass@localhost:8080',
database: 'test-db',
name: 'cldntlocal',
modelIndex: '',
requestDefaults: { proxy: 'http://admin:pass@localhost:7001' },
connector: 'cloudant',
debug: false }
cloudant Create underlying Nano instance, options={"url":"http://admin:pass@localhost:8080","database":"test-db","name":"c
ldntlocal","modelIndex":"","requestDefaults":{"proxy":"http://admin:pass@localhost:7001","agent":{"domain":null,"_events":{}
,"_eventsCount":1,"defaultPort":80,"protocol":"http:","options":{"keepAlive":true,"path":null},"requests":{},"sockets":{},"f
reeSockets":{},"keepAliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256}},"connector":"cloudant","debug
":false} requestDefaults={"proxy":"http://admin:pass@localhost:7001","agent":{"domain":null,"_events":{},"_eventsCount":1,"d
efaultPort":80,"protocol":"http:","options":{"keepAlive":true,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keep
AliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256}} +6ms
cloudant Automatic ping +4ms
nano { method: 'GET', headers: { 'content-type': 'application/json', accept: 'application/json' }, uri: 'http://admin:pass
@localhost:8080/_session' } +4ms
Web server listening at: http://0.0.0.0:3000
Browse your REST API at http://0.0.0.0:3000/explorer
nano { err: 'socket', body: undefined, headers: { statusCode: 500, uri: 'http://admin:pass@localhost:8080/_session' } } +2
03ms
Connection fails: Error: error happened in your connection
It will be retried for the next request.
events.js:160
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:7001
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
from loopback-connector-cloudant.
connect to https://github.com/strongloop-internal/scrum-apex/issues/240
from loopback-connector-cloudant.
Related Issues (20)
- Out dated / error in dependancies HOT 2
- Count returns a max of 25 HOT 5
- Query "like and case insensitive" with issues HOT 7
- Add support Geospatial queries HOT 5
- Fix the filter for hasManyThrough relation HOT 2
- Fix CI - 2 test cases failed HOT 3
- Run shared tests from both v3 and v4 of juggler
- FindById doesn't use Cloudant Read by Id method HOT 8
- [Spike] Add Support for Partitioned Databases HOT 18
- Update driver to nodejs/cloudant HOT 5
- Support creating partitioned index HOT 1
- Optimize query by reading partition key from payload HOT 1
- Compose the _id for a document in a partition database HOT 3
- [Epic] Add Support for Partitioned Database HOT 2
- findAll: Read partitionKey from `options` HOT 3
- Optimize findById for partitioned database HOT 4
- [Epic] Add Support for Partitioned Database (Post MVP) HOT 5
- [Blog] Blog post about the support for partitioned database HOT 2
- Invalid key partitioned using with Cloudant docker locally HOT 6
- Move to @ibm-cloud/cloudant HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loopback-connector-cloudant.