node-eventstore
node-eventstore copied to clipboard
Got error - The conditional request failed
Hi @adrai
I'm using dynamodb. I can save events by the commit method but then I call commit for a exists stream then I got this error The conditional request failed
for example:
first time will be success
getEventStream (aggregateId: string){
eventStore.getEventStream({
aggregateId: '123',
aggregate: 'Test',
context: 'Test'
}, (err, stream) => {
if (err) return
stream.addEvents([{
type: 'ACCOUNT_CREATED',
balance: 0,
}]);
stream.commit();
});
}
second time will be fail - "The conditional request failed"
getEventStream (aggregateId: string){
eventStore.getEventStream({
aggregateId: '123',
aggregate: 'Test',
context: 'Test'
}, (err, stream) => {
if (err) return
stream.addEvents([{
type: 'DEPOSITED',
amount: 200,
balance: 200,
}]);
stream.commit();
});
}