jshttp / etag

Create simple HTTP ETags

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken when graceful-fs 3.0 loaded in node.js 0.11.13

davisford opened this issue · comments

If I nvm use v0.11.13 and re-run my app, it blows up on etag here:

TypeError: argument entity must be string, Buffer, or fs.Stats
    at etag (/proj/node_modules/express/node_modules/etag/index.js:55:11)
    at SendStream.setHeader (/proj/node_modules/express/node_modules/send/index.js:724:15)
    at SendStream.send (/proj/node_modules/express/node_modules/send/index.js:500:8)
    at onstat (/proj/node_modules/express/node_modules/send/index.js:585:10)
    at Object.oncomplete (fs.js:97:15) 

versions in use: express@4.9.3, etag@1.3.1

etag works fine with 0.11.13. It's a bug with graceful-fs not working with 0.11.13. Please see isaacs/node-graceful-fs#31

If you downgrade to 0.11.12 or don't use graceful-fs or make sure every single graceful-fs in your dependency tree is less than 3.0 you won't have issues.

@Fishrock123 it's a graceful-fs bug with the 3.0 line that still hasn't been fixed is all.

Oh, and, sorry, by "not fixed" I mean it has been fixed 10 days ago, but just never published to npm yet. Feel free to bug graceful-fs :)

Related issue is isaacs/node-graceful-fs#31

In theory, if the dep requirement for graceful-fs is soft pinned to minor (^ or ~ or .x), you could just require the commit in your own package.json and the dep would resolve to that.

e.g.

{
  "dependancies": {
    "graceful-fs": "isaacs/node-graceful-fs#34e473a"
  }
}

I'm tired of these reports because of graceful-fs not supporting 0.11.13 and the fixed not being published yet. I'm adding support to this module for "fake" fs.Stats. This will mean your code will work, though be a little slower until graceful-fs is updated to support 0.11.13.

graceful-fs 3.0.3 has been released with the fix. In addition, this module has been working-around the issue for a while now :)