Skip to content

Comments

fix(gen2-migration): resolve bugs in codegen auth generator#14308

Merged
iliapolo merged 15 commits intoaws-amplify:gen2-migrationfrom
dgandhi62:codegen-auth-gen
Nov 3, 2025
Merged

fix(gen2-migration): resolve bugs in codegen auth generator#14308
iliapolo merged 15 commits intoaws-amplify:gen2-migrationfrom
dgandhi62:codegen-auth-gen

Conversation

@dgandhi62
Copy link
Contributor

@dgandhi62 dgandhi62 commented Oct 30, 2025

This pr fixes bugs in the auth code generator that were causing incorrect TypeScript generation during Gen1 to Gen2 migration.

  1. Fixed handling of combined email: true with emailOptions.
    Before this fix, simple email logic was suppported. Custom email verification messages were not migrating
  • Now properly generates verification subject/body configuration.
  • Prevents incorrect auth config generation for custom email settings
  1. Reference Auth Property Handling
    Before the fix, the code used runtime type inspection (typeof value === 'object') during code generation, which couldn't properly distinguish between different property types. This pr
  • Replaced generic object iteration with type-specific property handling
  • Separated string properties (userPoolId, identityPoolId, etc.) from object properties (groups)
  1. Lambda Function Path Validation
    When migrating from Gen1 to Gen2, the code tries to find Lambda function names from file paths. It expects the lambda code to follow a specific directory format and checks for the name hardcoded in that format. This is brittle and can fail easily if user decides to change their directory format for lambda functions. Therefore, this pr:
  • Added validation for Lambda source paths with clear error messages
  • Prevents runtime failures when Lambda paths don't follow expected format: amplify/backend/function/functionName/...
  1. Code Organization
  • Reorganizes certain parts of the code to maintain a better logical flow
  • Streamlines documentation for functions

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

@dgandhi62 dgandhi62 marked this pull request as ready for review October 31, 2025 16:20
@dgandhi62 dgandhi62 requested a review from a team as a code owner October 31, 2025 16:20
@iliapolo iliapolo changed the title fix: resolve bugs in codegen auth generator fix(gen2-migration): resolve bugs in codegen auth generator Nov 3, 2025
@iliapolo iliapolo merged commit d0f1037 into aws-amplify:gen2-migration Nov 3, 2025
4 checks passed
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