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

TypeError: Cannot read property 'filter' of undefined #30

Open
trdarr opened this issue Jan 19, 2016 · 1 comment
Open

TypeError: Cannot read property 'filter' of undefined #30

trdarr opened this issue Jan 19, 2016 · 1 comment

Comments

@trdarr
Copy link

trdarr commented Jan 19, 2016

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

$ brew install node
🍺  /usr/local/Cellar/node/5.4.1_1: 3,135 files, 35.5M
$ which node
/usr/local/bin/node
$ node --version
v5.4.1
$ which npm
/usr/local/bin/npm
$ npm --version
3.5.3
$ npm install -g vault
/usr/local/lib
`-- [email protected]
  +-- [email protected]
  | `-- [email protected]
  +-- [email protected]
  +-- [email protected]
  | +-- [email protected]
  | `-- [email protected]
  `-- [email protected]

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

$ vault --key github
/usr/local/lib/node_modules/vault/bin/vault:50
      keys = keys.filter(function(k) { return k.type === 'ssh-rsa' });
                 ^

TypeError: Cannot read property 'filter' of undefined
    at /usr/local/lib/node_modules/vault/bin/vault:50:18
    at Socket.<anonymous> (/usr/local/lib/node_modules/vault/node_modules/ssh-agent/lib/ssh_agent_client.js:294:12)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1255:8)
    at nextTickCallbackWith2Args (node.js:474:9)
    at process._tickCallback (node.js:388:17)

I realize now that this issue is caused by ssh-agent not starting as a result of my having tried to replace OS X’s built-in ssh-agent with the ssh-agent from Homebrew-installed OpenSSH—other people have had similar problems (Homebrew/homebrew-dupes#242).

While trying to reproduce this issue to submit it, I encountered a similar exception caused by a ~/.vault file left behind by a previous installation: when I tried to generate a password without the --key option, I got a TypeError.

$ vault github
/usr/local/lib/node_modules/vault/bin/vault:76
      var key = keys.filter(function(k) { return k.ssh_key === sshKey })[0];
                    ^

TypeError: Cannot read property 'filter' of undefined
    at /usr/local/lib/node_modules/vault/bin/vault:76:21
    at identitiesAnswer (/usr/local/lib/node_modules/vault/node_modules/ssh-agent/lib/ssh_agent_client.js:179:12)
    at Socket.<anonymous> (/usr/local/lib/node_modules/vault/node_modules/ssh-agent/lib/ssh_agent_client.js:280:12)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:146:16)
    at Socket.Readable.push (_stream_readable.js:110:10)
    at Pipe.onread (net.js:523:20)
@trdarr
Copy link
Author

trdarr commented Jan 20, 2016

I also now realize that this is almost identical to the other issue I opened in a few months ago (#29), and is partially fixed by the corresponding pull request (#27), so I’ll add a commit to that pull request that covers the other unguarded call to keys.filter.

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

1 participant