{"action":"opened","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-js/issues/750","labels_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/750/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/750/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-js/issues/750/events","html_url":"https://github.com/aws/aws-sdk-js/issues/750","id":110844863,"number":750,"title":"s3.getObject.createReadStream throws error even if it was handled","user":{"login":"andreasherzog","id":5593337,"avatar_url":"https://avatars.githubusercontent.com/u/5593337?v=3","gravatar_id":"","url":"https://api.github.com/users/andreasherzog","html_url":"https://github.com/andreasherzog","followers_url":"https://api.github.com/users/andreasherzog/followers","following_url":"https://api.github.com/users/andreasherzog/following{/other_user}","gists_url":"https://api.github.com/users/andreasherzog/gists{/gist_id}","starred_url":"https://api.github.com/users/andreasherzog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreasherzog/subscriptions","organizations_url":"https://api.github.com/users/andreasherzog/orgs","repos_url":"https://api.github.com/users/andreasherzog/repos","events_url":"https://api.github.com/users/andreasherzog/events{/privacy}","received_events_url":"https://api.github.com/users/andreasherzog/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-11T09:17:56Z","updated_at":"2015-10-11T09:17:56Z","closed_at":null,"body":"Hi, \r\non trying to download an object as Stream the awssdk throws an error that can't be handled if the key does not exist. I listen for the 'error' event of the Stream and handle occurring errors myself.\r\n\r\nCode:\r\n*noformat*\r\ns3Stream = self.s3sdk.getObject(params).createReadStream()\r\n            .on('error', function (err) {\r\n                console.log('READSTREAM error ');\r\n                console.log(err);\r\n            })\r\n            .on('end', function() { console.log('done.'); });\r\n*noformat*\r\n\r\nOutput:\r\n*noformat*\r\nREADSTREAM error\r\n{ [NoSuchKey: The specified key does not exist.]\r\n  message: 'The specified key does not exist.',\r\n  code: 'NoSuchKey',\r\n  time: Sun Oct 11 2015 09:05:10 GMT+0000 (UTC),\r\n  statusCode: 404,\r\n  retryable: false,\r\n  retryDelay: 30 }\r\n/src/my_aws/node_modules/aws-sdk/lib/request.js:30\r\n            throw err;\r\n                  ^\r\nNoSuchKey: The specified key does not exist.\r\n at Request.extractError (/src/my_aws/node_modules/aws-sdk/lib/services/s3.js:322:35)\r\n    at Request.callListeners (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\r\n    at Request.emit (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\r\n    at Request.emit (/src/my_aws/node_modules/aws-sdk/lib/request.js:595:14)\r\n    at Request.transition (/src/my_aws/node_modules/aws-sdk/lib/request.js:21:10)\r\n    at AcceptorStateMachine.runTo (/src/my_aws/node_modules/aws-sdk/lib/state_machine.js:14:12)\r\n    at /src/my_aws/node_modules/aws-sdk/lib/state_machine.js:26:10\r\n    at Request.<anonymous> (/src/my_aws/node_modules/aws-sdk/lib/request.js:37:9)\r\n    at Request.<anonymous> (/src/my_aws/node_modules/aws-sdk/lib/request.js:597:12)\r\n    at Request.callListeners (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:115:18)\r\n    at Request.emit (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\r\n    at Request.emit (/src/my_aws/node_modules/aws-sdk/lib/request.js:595:14)\r\n    at Request.transition (/src/my_aws/node_modules/aws-sdk/lib/request.js:21:10)\r\n    at AcceptorStateMachine.runTo (/src/my_aws/node_modules/aws-sdk/lib/state_machine.js:14:12)\r\n    at /src/my_aws/node_modules/aws-sdk/lib/state_machine.js:26:10\r\n    at Request.<anonymous> (/src/my_aws/node_modules/aws-sdk/lib/request.js:37:9)\r\n    at Request.<anonymous> (/src/my_aws/node_modules/aws-sdk/lib/request.js:597:12)\r\n    at Request.callListeners (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:115:18)\r\n    at callNextListener (/src/my_aws/node_modules/aws-sdk/lib/sequential_executor.js:95:12)\r\n    at IncomingMessage.onEnd (/src/my_aws/node_modules/aws-sdk/lib/event_listeners.js:207:11)\r\n    at IncomingMessage.emit (events.js:129:20)\r\n    at _stream_readable.js:908:16\r\n*noformat*\r\n\r\nWhen I handle this error directly on the event, this exception should not be thrown.\r\n\r\nThank you for looking into this.\r\n\r\n"}}