forked from TheDeveloper/http-aws-es
-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
The warning below is logged when using this lib with the es.helpers.bulk
function
Sample code:
const syncedAt = new Date().toISOString();
const bulkResult = await es.helpers.bulk({
datasource: [{syncedAt, id: '1'}],
onDocument(doc) {
return {index: {_index: 'test-index', _id: doc.id}};
}
});
console.log(bulkResult);
Note that it works fine for other es requests, e.g. const searchResult = await es.search({index: 'test-index', body: {query: {match_all: {}}}});
I've debugged this a bit and it seems that even the most simple custom transport class using a promise will lead to this error which makes me think that the current approach with a promise inside the Transport.request function doesn't work
class CustomTransport extends Transport {
request (params, options, callback) {
new Promise((resolve) => {
resolve();
})
.then(() => super.request(params, options, callback));
}
}
The logged warning:
at Object.then (/Users/zoellner/bc-books/bcb-server-api/node_modules/@elastic/elasticsearch/lib/Transport.js:337:18)
(node:36053) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:36053) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ricoli
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed