Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

req.path is sometimes not defined #79

Closed
thestephenmarshall opened this issue Mar 24, 2016 · 2 comments
Closed

req.path is sometimes not defined #79

thestephenmarshall opened this issue Mar 24, 2016 · 2 comments

Comments

@thestephenmarshall
Copy link

As of #78, I am noticing that req.path is not always defined. I am using Express 4 here and have found a little information, but it doesn't explain the why. The OP mentions "positioning of middleware", but I am unsure how that might trigger this bug. Overall, I'm wondering what the advantage is of using req.path vs req.url. Here's the stack trace:

TypeError: Cannot read property 'indexOf' of undefined
    at getFilenameFromUrl (/Users/stephenmarshall/code/singular-web-server/node_modules/webpack-dev-middleware/middleware.js:129:9)
    at webpackDevMiddleware (/Users/stephenmarshall/code/singular-web-server/node_modules/webpack-dev-middleware/middleware.js:175:18)
    at call (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:239:7)
    at next (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:183:5)
    at handleIe (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/foxy/lib/utils.js:191:5)
    at call (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:239:7)
    at next (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:183:5)
    at next (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:161:14)
    at Function.handle (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:186:3)
    at Server.app (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/connect/index.js:51:37)
    at Server.<anonymous> (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/socket.io/node_modules/engine.io/lib/server.js:434:22)
    at Server.<anonymous> (/Users/stephenmarshall/code/singular-web-server/node_modules/browser-sync/node_modules/socket.io/lib/index.js:260:16)
    at emitTwo (events.js:87:13)
    at Server.emit (events.js:172:7)
    at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
@tony2nite
Copy link

I had this error just start appearing, seemingly after the latest release. Rolling webpack-dev-middleware back "1.5.1", I don't get the error.

ijse added a commit to ijse/webpack-dev-middleware that referenced this issue Mar 24, 2016
afc163 added a commit to ant-design/ant-design that referenced this issue Mar 25, 2016
@jhnns jhnns closed this as completed in a9fc5b2 Mar 25, 2016
@jhnns
Copy link
Member

jhnns commented Mar 25, 2016

I've reverted the broken commit. I don't know why @sokra has merged it in the first place. Its purpose is unclear to me.

I'll try to publish this asap (don't have the rights to publish it on npm 😞).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants