question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unix socket support

See original GitHub issue

Is it possible to use express with unix socket instead of host:port ?

The listen signature just call underlying server listen method, so I tried with:

server = require('net').createServer(express());
server.listen('/tmp/sock', function() {
  fs.chmodSync('/tmp/sock', 0777);
});

But then when, through nginx, I try to access a page, express crashes with the following error:

[...]/node_modules/express/lib/router/index.js:140
  var search = 1 + req.url.indexOf('?');
                          ^

TypeError: Cannot read property 'indexOf' of undefined
    at Function.handle ([...]/node_modules/express/lib/router/index.js:140:27)
    at EventEmitter.handle ([...]/node_modules/express/lib/application.js:173:10)
    at Server.app ([...]/node_modules/express/lib/express.js:38:9)
    at emitOne (events.js:77:13)
    at Server.emit (events.js:169:7)
    at Pipe.onconnection (net.js:1431:8)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, Oct 21, 2016

Glad to hear you got it working! You’re absolutely welcome to make a PR to update/add to our documentation. There is a link to edit the docs and open a PR all within your web browser at the bottom of every documentation page 😃

0reactions
magne4000commented, Oct 21, 2016

Ok my bad … it seems rather logical to use http instead of net. Now perhaps we need a note in listen documentation to mention that socket are also supported ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error : No unix socket support on windows connecting mongodb
I had the same issue and was able to fix it by removing the full url (for example: mongodb://myuser:mypassword@mongodb-test.mydomain.com/my_database ) in ...
Read more >
UNIX domain sockets - IBM
UNIX domain sockets support both stream-oriented, TCP, and datagram-oriented, UDP, protocols. You cannot start a UNIX domain socket for raw socket protocols.
Read more >
unix(7) - Linux manual page - man7.org
UNIX domain sockets support passing file descriptors or process credentials to other processes using ancillary data. Address format A UNIX domain socket ......
Read more >
Unix domain socket - Wikipedia
A Unix domain socket aka UDS or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes ...
Read more >
Unix Sockets are Now Supported on Windows - Bozhidar Batsov
I was surprised to learn that Windows has added support for Unix sockets (AF_UNIX) a few years ago (in 2017). From the announcement...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found