diff --git a/package.json b/package.json index c8aa002ca..00b2e2357 100644 --- a/package.json +++ b/package.json @@ -90,8 +90,7 @@ "dependencies": { "agentkeepalive": "^2.2.0", "chalk": "^1.0.0", - "lodash": "^4.12.0", - "promise": "^7.1.1" + "lodash": "^4.12.0" }, "repository": { "type": "git", diff --git a/src/lib/transport.js b/src/lib/transport.js index 9735e5449..038828f02 100644 --- a/src/lib/transport.js +++ b/src/lib/transport.js @@ -7,7 +7,6 @@ module.exports = Transport; var _ = require('./utils'); var errors = require('./errors'); var Host = require('./host'); -var Promise = require('promise/lib/es6-extensions'); var patchSniffOnConnectionFault = require('./transport/sniff_on_connection_fault'); var findCommonProtocol = require('./transport/find_common_protocol'); @@ -101,6 +100,13 @@ Transport.nodesToHostCallbacks = { }; Transport.prototype.defer = function () { + if (typeof Promise === 'undefined') { + throw new Error( + 'No Promise implementation found. In order for elasticsearch-js to create promises ' + + 'either specify the `defer` configuration or include a global Promise shim' + ) + } + var defer = {}; defer.promise = new Promise(function (resolve, reject) { defer.resolve = resolve;