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!: Bugfix/supported events missing key #62

Merged
merged 3 commits into from
Jun 27, 2024

Conversation

suhussai
Copy link
Contributor

@suhussai suhussai commented Jun 27, 2024

Issue # (if applicable)

Closes #.

Reason for this change

The change is to fix an issue with the EventManager class and ensure that all DetailType enum entries have corresponding values in the supportedEvents object. This is necessary to prevent errors when creating new event-manager rules using the getOrCreateRule function.

Marking this as a breaking change because the default CognitoAuth no longer disables setting of scopes for API GWs.

Description of changes

  1. In src/utils/event-manager.ts, the supportedEvents object is updated to include entries for tenantUserCreated and tenantUserDeleted events.

  2. A new test suite is added in test/event-manager.test.ts to ensure that all DetailType enum entries have corresponding values in the supportedEvents object.

  3. In src/control-plane/integ.default.ts, a CognitoAuth instance is created and passed to the ControlPlane construct to enable testing with authentication disabled.

  4. In src/control-plane/auth/cognito-auth.ts, the createAdminUserFunction is now created in the constructor instead of the createAdminUser method.

Description of how you validated changes

Checklist

  • My code adheres to the CONTRIBUTING GUIDE
  • I have updated the relevant documentation (if applicable).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Copy link
Contributor

@tobuck-aws tobuck-aws left a comment

Choose a reason for hiding this comment

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

This lgtm, but we should revisit the design of this and see if we can't come up with something less fragile. Changing code in two places for every new supported event is error prone. Seems like we could optimize this.

@suhussai
Copy link
Contributor Author

This lgtm, but we should revisit the design of this and see if we can't come up with something less fragile. Changing code in two places for every new supported event is error prone. Seems like we could optimize this.

Agreed! The test that I added helps, but it's a band-aid fix.

@suhussai suhussai merged commit f699f38 into main Jun 27, 2024
12 checks passed
@suhussai suhussai deleted the bugfix/supportedEvents-missing-key branch June 27, 2024 22:39
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.

2 participants