RemoteMetering / geteventstore-promise

An EventStore http+tcp wrapper package
MIT License
31 stars 17 forks source link

Stopped receiving events from ES after Receiving Unhandled promise rejection error #87

Open gameboyll opened 3 years ago

gameboyll commented 3 years ago

I use Nest,js with https://github.com/RemoteMetering/geteventstore-promise for an e-commerce site. It had been working fine for the first couple of months and recently up until now we've got strange behaviour from ES. Sometimes we see an error that would stop us from receiving events from ES, which I will show more below, or connection dropped then we have to restart the system to get it working again, but soon it would happen again.

The first few times it happened at the time of creating order, we decided to reduce data in the stream and we saw that we have not got the error there anymore. Now we are facing the issue with payment. After we have got the payment confirmed, we would create maximum of 5 events of similar data as below:

https://jsoneditoronline.org/#left=cloud.9fb5ca86cddf402eb1b14e132e19e650

The error I received is:

(node:18) 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: 7) (node:18) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'error' of undefined at VolatileSubscriptionOperation. (/usr/src/app/dist/src/event-store/event-store.js:101:25) at Generator.next () at /usr/src/app/dist/src/event-store/event-store.js:20:71 at new Promise () at __awaiter (/usr/src/app/dist/src/event-store/event-store.js:16:12) at VolatileSubscriptionOperation.onDropped [as _subscriptionDropped] (/usr/src/app/dist/src/event-store/event-store.js:100:16) at /usr/src/app/node_modules/node-eventstore-client/lib/dist.js:3831:14 at VolatileSubscriptionOperation.module.exports.SubscriptionOperation._executeActions (/usr/src/app/node_modules/node-eventstore-client/lib/dist.js:3890:15) at processImmediate (internal/timers.js:439:21)

Could it be caused by the size of payload and the amount of events are too much? I didn't think it would be the problem, but I don't know what else could cause this issue.

Original Thread: https://discuss.eventstore.com/t/stopped-receiving-events-from-es-after-receive-unhandled-promise-rejection-error/2689

mmuller99 commented 3 years ago

Hi @gameboyll , my apologies for not replying earlier. The size of the payload doesn't strike me as the problem as well. It seems as though the error occurs within the tcp package that this package wraps, we have however made some recent changes in 3.3.0 that hopefully improves subscription connection stability. If you still have problems, can you please provide a code snippet that will help us reproduce the issue?