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 _isValidMessage check #1181

Merged
merged 2 commits into from
Dec 11, 2024
Merged

Fix _isValidMessage check #1181

merged 2 commits into from
Dec 11, 2024

Conversation

bryophyta
Copy link
Contributor

@bryophyta bryophyta commented Dec 3, 2024

What does this change?

The _isValidMessage check was diffing two different things: Set<string> and Set<string[]> so it was always failing afaict: https://logs.gutools.co.uk/s/editorial-tools/app/r/s/XpbfG

How to test

  • Deploy to CODE
  • Send a valid message via the lambda console, check that the failure message is no longer logged, and that the work still continues.
  • Send an invalid message, check that the failure message is logged and work ceases.

Valid message

{
  "Records": [
    {
      "kinesis": {
        "data": "ICAgIHsidHlwZSI6InByb2plY3QtdXBkYXRlZCIsImlkIjoiMjc5NzciLCJ0aXRsZSI6IlRlc3QgdGl0bGUiLCJzdGF0dXMiOiJJbiBQcm9kdWN0aW9uIiwiY29tbWlzc2lvbklkIjoiNDM4MSIsImNvbW1pc3Npb25UaXRsZSI6IlRvZGF5IGluIEZvY3VzIERlY2VtYmVyIDIwMjQiLCJwcm9kdWN0aW9uT2ZmaWNlIjoiVUsiLCJjcmVhdGVkIjoiMjAyNC0xMi0xMVQxMTo0MTowMC40MDYwMDArMDA6MDAifQ=="
      }
    }
  ]
}

Invalid message

(same payload as valid, except the 'id' field is remove):

{
  "Records": [
    {
      "kinesis": {
        "data": "eyJ0eXBlIjoicHJvamVjdC11cGRhdGVkIiwidGl0bGUiOiJUZXN0IHRpdGxlIiwic3RhdHVzIjoiSW4gUHJvZHVjdGlvbiIsImNvbW1pc3Npb25JZCI6IjQzODEiLCJjb21taXNzaW9uVGl0bGUiOiJUb2RheSBpbiBGb2N1cyBEZWNlbWJlciAyMDI0IiwicHJvZHVjdGlvbk9mZmljZSI6IlVLIiwiY3JlYXRlZCI6IjIwMjQtMTItMTFUMTE6NDE6MDAuNDA2MDAwKzAwOjAwIn0="
      }
    }
  ]
}

How can we measure success?

Have we considered potential risks?

Images

Accessibility

@bryophyta bryophyta requested a review from a team as a code owner December 3, 2024 11:40
@andrew-nowak
Copy link
Member

ohhhh great catch! Can we add a return to line 64 as well so this validation actually stops the processing from continuing :D

@bryophyta bryophyta force-pushed the pf/fix-valid-message-check-logic branch from eff3597 to ca6ef67 Compare December 11, 2024 11:33
bryophyta and others added 2 commits December 11, 2024 12:20
Co-authored-by: Andrew Nowak <10963046+andrew-nowak@users.noreply.github.com>
@bryophyta bryophyta force-pushed the pf/fix-valid-message-check-logic branch from ca6ef67 to 49cdb84 Compare December 11, 2024 12:20
@bryophyta bryophyta merged commit acfdb2d into main Dec 11, 2024
3 checks passed
@bryophyta bryophyta deleted the pf/fix-valid-message-check-logic branch December 11, 2024 12:38
@prout-bot
Copy link

Seen on PROD (merged by @bryophyta 6 minutes and 24 seconds ago) Please check your changes!

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.

3 participants