Azure-docs: No response is received from the http.get request

Created on 12 Apr 2018  Â·  10Comments  Â·  Source: MicrosoftDocs/azure-docs

Followed the tutorial up until Part 5 however when I tried to get data from my CosmosDB it does not return a result instead an error of: Failed to load resource: net::ERR_EMPTY_RESPONSE.

I am able to get to the console.log('Getting Heroes...'); on my code for getHeroes below:

function getHeroes(req, res) {
console.log('Getting Heroes...');
const docquery = Hero.find({}).read(ReadPreference.NEAREST).limit(5);
docquery
.exec()
.then(heroes => {
res.status(200).json(heroes);
console.log('Data data has been taken!');
})
.catch(error => {
res.status(500).send(error);
return;
});
}


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

cosmos-dsvc cxp doc-bug in-progress triaged

All 10 comments

Correction I am not able to get to the console.log('Getting Heroes...'); I am able to reach this line of code: this.http.get>(${api}/heroes)

@jcjp Thanks for the feedback. We are actively investigating and will get back to you soon.

Okay my debugger was able to console.log 'Getting Heroes' twice and then the errors is display on the browser's console.

@jcjp Let me see if an update has been made to this this tutorial and if has been published yet, if not, I will forward on to the content owner to be fixed. Thank you for responding with the issue you are experiencing.
Regards,
Mike

@jcjp A fix was made to this tutorial via Duplicate key error #6955 and Mongoose connection error #6905
Let's hope we have all the issues ironed out.

Hi Mike,

May I ask where could I find the cosmosdb account name? Let's say I have a URI of https://sample.documents.azure.com:443/, is it correct that it is the 'sample' string in the URI?

Hi Mike,

I tried connecting using the mongodb console to my cosmosDB, however I am encountering the following errors:
getaddrinfo() failed: No such host is known.
Unable to reach primary for set Please check network connectivity and the status of the set.
Error: connect failed to replica set .

It seems like I am not able to connect to my cosmosDB.

If you are using a Cosmos DB instance deployed in Azure, you need to be aware of what endpoint you have set-up during deployment.
As an example, the following screen capture shows the available API options when deploying a new Cosmos DB instance.
screenshot 105

After deploying the Cosmos DB instance, in the Overview blade, you can see the applicable URI values, based upon the API type you have configured during set-up.
screenshot 104 _li

So, in the case of https://sample.documents.azure.com:443/, you would replace 'sample' with the instance name you established for the Cosmos DB instance you are using.

Does this information help you?
Regards,
Mike

@jcjp We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

@Mike thank you for your continued support and it seems that my colleague has set our CosmosDB to use SQL.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ponant picture Ponant  Â·  3Comments

jamesgallagher-ie picture jamesgallagher-ie  Â·  3Comments

Agazoth picture Agazoth  Â·  3Comments

behnam89 picture behnam89  Â·  3Comments

Favna picture Favna  Â·  3Comments