Azure Underfined server.name

320 views
Skip to first unread message

almarjin

unread,
Jul 31, 2012, 1:33:18 PM7/31/12
to nod...@googlegroups.com
Hi,

I'm having problem with restify.

My Code:

var restify = require("restify");
var port = process.env.port || 8080;

function send(req, res, next) {
res.send('hello ' + req.params.name);
return next();
}

var server = restify.createServer();
server.post('/hello', function create(req, res, next) {
res.send(201, Math.random().toString(36).substr(3, 8));
return next();
});
 
server.put('/hello', send);
server.get('/hello/:name', send);
  
server.head('/hello/:name', send);
server.del('hello/:name', function rm(req, res, next) {
res.send(204);
return next();
});
 
 server.listen(port, function() {
console.log('%s listening at %s', server.name, server.url);
});

URL:


Error result:

iisnode encountered an error when processing the request.

HRESULT: 0x6d
HTTP status: 500
HTTP reason: Internal Server Error

You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

The last 64k of the output generated by the node.exe process to stdout and stderr is shown below:

restify listening at http://undefined:undefined
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test
hello
test

I would also like to know if there's a conflict between Restify and node-server?

Thanks,

mscdex

unread,
Jul 31, 2012, 5:05:42 PM7/31/12
to nodejs
On Jul 31, 1:33 pm, almarjin <almar...@gmail.com> wrote:
> console.log('%s listening at %s', server.name, server.url);
> [...]
> restify listening at http://undefined:undefined

It's not server.name that is undefined (it's "restify"), but the
content of server.url. I ran your sample code and it showed up for me
on my Windows machine on node 0.8.4.

What shows up in your log if you insert this statement right after the
other console.log statement from above?:
console.log('net.Server.address() === ' +
require('util').inspect(server.server.address()));

Also, what node version is being used here?

almarjin

unread,
Aug 6, 2012, 3:38:50 AM8/6/12
to nod...@googlegroups.com
Hi mscdex,

Thanks for the reply.

I tried this code "  console.log('net.Server.address() === ' + ('util').inspect(server.server.address()));  " from you and there's no value showing on the page. I also noticed that the azure needs to start and stop sometimes for the changes to take effect. My problem about restify wasn't really a problem maybe the server just need to start/stop that time. 

My current problem now is this statement "sql.query(conn_str, "SELECT * FROM RESULT WHERE GameID = 1", function(err, results) {});" in a required file(module). In this required file I have "var sql = require('node-sqlserver'); for SQL server and var conn_str = "my SQL driver" that results an error(below).

http.js:600
    throw new TypeError('first argument must be a string or Buffer');
          ^
TypeError: first argument must be a string or Buffer
    at ServerResponse.write (http.js:600:11)
    at Server.<anonymous> (C:\DWASFiles\Sites\leagues\VirtualDirectory0\site\wwwroot\server.js:34:6)
    at Server.emit (events.js:70:17)
    at HTTPParser.onIncoming (http.js:1572:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
    at Socket.ondata (http.js:1468:22)
    at Pipe.onread (net.js:374:27)

Thanks,
Reply all
Reply to author
Forward
0 new messages