Skip to content

Ved 000 mns auth retry#1278

Open
amarauzoma wants to merge 2 commits intostaging/VED-16-mns-vacc-event-notificationsfrom
VED-000-MNS-Auth-Retry
Open

Ved 000 mns auth retry#1278
amarauzoma wants to merge 2 commits intostaging/VED-16-mns-vacc-event-notificationsfrom
VED-000-MNS-Auth-Retry

Conversation

@amarauzoma
Copy link
Contributor

Summary

  • Routine Change
  • ❗ Breaking Change
  • 🤖 Operational or Infrastructure Change
  • ✨ New Feature
  • ⚠️ Potential issues that might be caused by this change

Add any other relevant notes or explanations here. Remove this line if you have nothing to add.

Reviews Required

  • Dev
  • Test
  • Tech Author
  • Product Owner

Review Checklist

ℹ️ This section is to be filled in by the reviewer.

  • I have reviewed the changes in this PR and they fill all of the acceptance criteria of the ticket.
  • If there were infrastructure, operational, or build changes, I have made sure there is sufficient evidence that the changes will work.
  • If there were changes that are outside of the regular release processes e.g. account infrastructure to setup, manual setup for external API integrations, secrets to set, then I have checked that the developer has flagged this to the Tech Lead as release steps.
  • I have checked that no Personal Identifiable Data (PID) is logged as part of the changes.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2026

This branch is working on a ticket in the NHS England VED JIRA Project. Here's a handy link to the ticket:

VED-000

@amarauzoma amarauzoma changed the base branch from master to staging/VED-16-mns-vacc-event-notifications March 9, 2026 16:26
Copy link
Contributor

@avshetty1980 avshetty1980 left a comment

Choose a reason for hiding this comment

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

Nice! some minor comments

Copy link
Collaborator

@dlzhry2nhs dlzhry2nhs left a comment

Choose a reason for hiding this comment

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

Nice work, still a couple of things needed.

  • Judging from Matt's PR, it looks like we could also remove the cache.py file in the api_clients directory.
  • This is our bad, I was meant to check Akin had actioned this, but it looks like we have 2 copies of pds_get_patient_details. One in the ID Sync Lambda, which you've changed, but we also have one instance of it in the lambdas/shared/src/common/api_clients/get_pds_details.py file. @Akol125 should be able to pair up for it, if required, but recommend adjust so there is only one in shared and then the ID Sync Lambda also uses it. But as a minimum, we'll need to adjust the instance in shared, so it too uses the authenticator in the correct way.
  • We also need to adjust mns_setup so it too instantiates the authenticator in the correct way.

You have some unit test and lint errors. Hopefully fixing the above will help with unit tests - I am happy to lend a hand if linting is still an issue.

  • Finally, the key piece of work is to instantiate the MNS Service and PDS Service once within the new Lambda function. They should take separate authenticator instances for cleanliness (and because in future they would actually be using different secrets). At the moment, if you walk the mns publisher code, you will find we will be authenticating on every invocation of the Lambda function. This is not sustainable as - at least during working hours - several Lambdas should be going non-stop, so we want to reuse the authentication token and only refresh every 9-10 minutes to avoid too much pressure on the Apigee Auth service (not to mention the fact that it will be slow).

Tests may need adjusting to account for this e.g. not targeting the Lambda handler but the record processor for tests and injecting required values. Or, if you wanna test Lambda handler, mocking env vars at import time.

Again, hope this makes sense but happy to walk through this when I have some time if it doesn't.

@sonarqubecloud
Copy link

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

Successfully merging this pull request may close these issues.

3 participants