Reputation: 418
In NodeJS I`m trying to connect to a Cosmos DB using the Documentdb library, as the getting starter of the azure documentation says in the TODO List Example. Tutorial Here
If I use an Internet that is not behind a proxy it works.
This is the connection code:
var DocumentDBClient = require('documentdb').DocumentClient;
var docDbClient = new DocumentDBClient(config.host, {
masterKey: config.authKey
});
But when I'm behind a proxy, the connection never occur's. I`m getting an "Error: connect ETIMEDOUT"
In other node JS apps, if I want to make a request of a webservice, I just configure the proxy for the request. For example with request:
request = require('request').defaults({
proxy:'http://USERNAME:[email protected]:8080',
});
Is there a way to configure the proxy in DocumentDB to connect to the DB in Azure (NodeJS)?
Upvotes: 1
Views: 691
Reputation: 136206
I've not personally tried it but I was going through the source code of the SDK and found out that ConnectionPolicy
has a parameter called ProxyUrl
. Can you try something like the following:
var connectionPolicy = new DocumentBase.ConnectionPolicy();
connectionPolicy.ProxyUrl = 'http://USERNAME:[email protected]:8080';
var docDbClient = new DocumentDBClient(config.host, {
masterKey: config.authKey
}, connectionPolicy);
Upvotes: 3