Stubborn
Stubborn

Reputation: 330

Why do I get extra characters when this simple node app is hosted on Azure

This is the stock node app from Microsoft Documentation. Just followed instructions here -> https://learn.microsoft.com/en-us/azure/app-service/app-service-web-get-started-nodejs

All it has in index.js is this

var http = require('http');
var server = http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World!");
});
var port = process.env.PORT || 1337;
server.listen(port);
console.log("Server running at http://localhost:%d", port);

App runs ok on local machine and give expected output.

Only when I host on Azure and access the app, my response looks like this

 e
 Hellooo World!
 0

If I change the 'Hello World!' to some other string,

the 'e' part of response changes along with the string. The 0 stays.

Any idea why I'm getting the extra lines above and below the hello world line?

Upvotes: 1

Views: 97

Answers (1)

Stubborn
Stubborn

Reputation: 330

Answering my own question -

I had "application insights" turned on in the app I manually created. That was causing the extra characters in output. Turned that off and everything is fine

Upvotes: 1

Related Questions