Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error - The conditional request failed #124

Open
jacklam718 opened this issue Mar 10, 2018 · 0 comments
Open

Got error - The conditional request failed #124

jacklam718 opened this issue Mar 10, 2018 · 0 comments

Comments

@jacklam718
Copy link

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();
  });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant