jcoglan / vault

Generates safe passwords so you never need to remember them

Home Page:https://getvau.lt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: msecs must be a number

trdarr opened this issue · comments

I use Homebrew to install Node on OS X Mavericks, then use npm to install Vault 0.3.0.

$ brew install node
🍺  /usr/local/Cellar/node/0.12.0: 2196 files, 26M
$ which node
/usr/local/bin/node
$ node --version
v0.12.0
$ npm --version
2.5.1
$ npm install -g vault
vault@0.3.0 /usr/local/lib/node_modules/vault

When I try to generate a password with my SSH key, I get a TypeError.

$ vault --key github
timers.js:156
    throw new TypeError('msecs must be a number');
          ^
TypeError: msecs must be a number
    at Object.exports.enroll (timers.js:156:11)
    at Socket.setTimeout (net.js:329:12)
    at SSHAgentClient._request (/usr/local/lib/node_modules/vault/node_modules/ssh-agent/lib/ssh_agent_client.js:299:10)
    at SSHAgentClient.requestIdentities (/usr/local/lib/node_modules/vault/node_modules/ssh-agent/lib/ssh_agent_client.js:185:15)
    at CLI.sign [as _signData] (/usr/local/lib/node_modules/vault/bin/vault:75:12)
    at null.<anonymous> (/usr/local/lib/node_modules/vault/node/cli.js:212:12)
    at /usr/local/lib/node_modules/vault/node/local_store.js:99:14
    at /usr/local/lib/node_modules/vault/node/local_store.js:107:23
    at fs.js:265:20
    at FSReqWrap.oncomplete (fs.js:99:15)

This is caused by an apparent bug in node-ssh-agent. The SSHAgentClient constructor does not set this.timeout if options is not provided, so socket#setTimeout gets called with undefined.

This can be fixed in Vault by providing options, i.e., new SSH({ timeout: 1000 }).

Closing this because mcavage/node-ssh-agent#5 has been merged.

The fix is available as of node-ssh-agent 0.2.3.