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

fix(api): malformed filters in messages throw errors #4308

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

p-fernandez
Copy link
Contributor

What change does this PR introduce?

Fixes errors thrown by malformed filters in messages.

Why was this change needed?

To fix this:
https://novu-r9.sentry.io/issues/4518246046/?alert_rule_id=10492815&alert_timestamp=1696232113867&alert_type=email&environment=production&notification_uuid=1f7176c6-ff05-4643-9a24-8b06a20c32e5&project=6248811&referrer=alert_email

Other information (Screenshots)

@p-fernandez p-fernandez self-assigned this Oct 2, 2023
variables.push(...filterVariables);
const filters = Array.isArray(message.filters) ? message.filters : [];
const filteredVariables = filters.flatMap((filter) => {
const filteredChildren = filter.children?.filter((item) => item.on === FilterPartTypeEnum.PAYLOAD) || [];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This covers the Sentry error captured.

Copy link
Contributor

@ainouzgali ainouzgali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!!

@p-fernandez p-fernandez merged commit a2337d8 into next Oct 2, 2023
21 of 22 checks passed
@p-fernandez p-fernandez deleted the fix-content-service-filter-variables branch October 2, 2023 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants