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: amplify configure with auth userGroups #14046

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

ashwinkumar6
Copy link
Member

@ashwinkumar6 ashwinkumar6 commented Dec 2, 2024

Description of changes

Amplify configure with auth user groups throws a type error not assignable to type 'Record<string, UserGroupPrecedence>[]'. This PR loosens this type to avoid this error.

Issue #, if available

#14045

Description of how you validated changes

  • Tested that the following with amplify.configure does not throw any type error
  "auth": {
    "groups": [
      {
        "ADMIN": { "precedence": 0 },
        "USER": { "precedence": 1 }
      },
      {
        "USER": { "precedence": 0 }
      },
      {
        "TEST": { "precedence": 2 },
        "USER": { "precedence": 1 },
        "ADMIN": { "precedence": 0 }
      }
    ],
  • amplify.getConfig returns the correct config

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -133,6 +133,7 @@ describe('parseAmplifyOutputs tests', () => {
unauthenticated_identities_enabled: true,
mfa_configuration: 'OPTIONAL',
mfa_methods: ['SMS'],
groups: [{ ADMIN: { precedence: 0 }, USER: { precedence: 0 } }],
Copy link
Member Author

Choose a reason for hiding this comment

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

This test just checks if outputs is parsed correctly (which already works), adding this in as a sanity check.
Ideally to catch this issue, we would need to amplify.configure from an external json file, can add this as a fast follow

@ashwinkumar6 ashwinkumar6 marked this pull request as ready for review December 2, 2024 22:00
@ashwinkumar6 ashwinkumar6 requested review from cshfang, HuiSF, pranavosu and a team as code owners December 2, 2024 22:00
@ashwinkumar6 ashwinkumar6 merged commit fb8dadb into aws-amplify:main Dec 2, 2024
30 checks passed
ashwinkumar6 added a commit to ashwinkumar6/amplify-js that referenced this pull request Dec 3, 2024
Co-authored-by: Ashwin Kumar <ashwsrir@amazon.com>
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