We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug
I am sure this is an edge case, but I found this behavior when testing out the code.
The eventType provided in the RULES is matching with the wrong event.type when two names are similar but differ by only the last letter.
For example, when creating a rule with an eventType:
eventType: ['something-updated', 'something-deleted']
and passing an event into the handler with this type:
id: 'fcc12355-f339-4f71-bbed-eee646535bbb', type: 'something-update',
It will match that rule though the event types are not the same.
To Reproduce Steps to reproduce the behavior:
{ id: 'fcc12355-f339-4f71-bbed-eee646535bbb', type: 'something-update', }
{ id: 'p4', flavor: materialize, eventType: ['something-update**d'**, 'something-deleted'], toUpdateRequest }
export const handler = async (event) => initialize(PIPELINES, OPTIONS) .assemble(fromKinesis(event)) .through(toPromise)
Expected behavior The event.type in the event body should only match with the eventType in the RULES when the match is exact.
The text was updated successfully, but these errors were encountered:
Remove .join() in the isArray else statement
Change this code:
export const filterOnEventType = (rule, uow) => { if (typeof rule.eventType === 'string') { return uow.event.type === rule.eventType; } else if (rule.eventType instanceof RegExp) { return rule.eventType.test(uow.event.type); } else if (isArray(rule.eventType)) { return rule.eventType.join().indexOf(uow.event.type) > -1; } else if (isFunction(rule.eventType)) { return rule.eventType(uow.event.type, rule); } else { throw new Error(`Rule: ${rule.id}, has improperly configured eventType filter. Must be a string, array of string, regex or function.`); } };
to this:
export const filterOnEventType = (rule, uow) => { if (typeof rule.eventType === 'string') { return uow.event.type === rule.eventType; } else if (rule.eventType instanceof RegExp) { return rule.eventType.test(uow.event.type); } else if (isArray(rule.eventType)) { return rule.eventType.indexOf(uow.event.type) > -1; } else if (isFunction(rule.eventType)) { return rule.eventType(uow.event.type, rule); } else { throw new Error(`Rule: ${rule.id}, has improperly configured eventType filter. Must be a string, array of string, regex or function.`); } };
Sorry, something went wrong.
No branches or pull requests
Describe the bug
I am sure this is an edge case, but I found this behavior when testing out the code.
The eventType provided in the RULES is matching with the wrong event.type when two names are similar but differ by only the last letter.
For example, when creating a rule with an eventType:
and passing an event into the handler with this type:
It will match that rule though the event types are not the same.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The event.type in the event body should only match with the eventType in the RULES when the match is exact.
The text was updated successfully, but these errors were encountered: