mongoosastic: Error [ERR_UNHANDLED_ERROR]: Unhandled error. (null)

Your Environments

  • mongoosastic version: 4.5.0
  • node version: 12.2.0
  • mongoose version: 5.6.4
  • elasticsearch version: 7.x

Expected Behavior

what should we do to get more info from error? e.g which model or docs are throwing error or something like that.

Actual Behavior

crash the app on production env

Error Stack

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (null)
at EventEmitter.emit (events.js:185:17)
at node_modules/mongoosastic/lib/mongoosastic.js:734:23
at respond (node_modules/mongoosastic/node_modules/elasticsearch/src/lib/transport.js:336:9)
at checkRespForFailure (node_modules/mongoosastic/node_modules/elasticsearch/src/lib/transport.js:274:7)
at HttpConnector.<anonymous> (node_modules/mongoosastic/node_modules/elasticsearch/src/lib/connectors/http.js:166:7)
at IncomingMessage.wrapper (node_modules/lodash/lodash.js:4935:19)
at IncomingMessage.emit (events.js:201:15)
at endReadableNT (_stream_readable.js:1130:12)
t processTicksAndRejections (internal/process/task_queues.js:84:9) {
context: null
 }

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 17

Commits related to this issue

Most upvoted comments

User.synchronize() tries to insert existing indexes from MongoDB via existing mapping. It seems that we need to clear the mapping and create a fresh one. But the question is how?

Same for me. After that, I seen it conflict between mongoosastic with elasticsearch.

I removed code the below and it working.

let stream = User.synchronize();
let count = 0;

stream.on('data', function(err, doc){
	count++;
	console.log(count);
});
stream.on('close', function(){
	console.log('indexed all User documents!');
});
stream.on('error', function(err){
	console.log(err);
});

Same for me. After that, I seen it conflict between mongoosastic with elasticsearch.

I removed code the below and it working.

let stream = User.synchronize();
let count = 0;

stream.on('data', function(err, doc){
	count++;
	console.log(count);
});
stream.on('close', function(){
	console.log('indexed all User documents!');
});
stream.on('error', function(err){
	console.log(err);
});