Skip to content

Unable to Add Older Event Versions to a Channel via SDK Due to race condition #2106

@boyney123

Description

@boyney123

Migrated from event-catalog/sdk#94

I tried this:

When attempting to add an event to a channel using the SDK, an error is thrown if a "newer" version of the event already exists. However, adding the "same" version multiple times works without issue.

It appears to be a dedicated check enforcing this restriction, but it is unclear why this should be the case. Upon investigation, it seems that this behavior might be caused by a race condition in the following code:

await rmMessageById(directory)(_message.id, _message.version, true);
await writeMessage(pathToResource)(message);

This happened:

An error was thrown when trying to add the newer version.

However, adding the same version multiple times worked without issue.

I expected this:

Adding a older version of an event should be possible without errors.

EventCatalog Version

1.4.8

Node.js Version

No response

Platform(s)

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdkIssues related to @eventcatalog/sdk package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions