Skip to content

(gen2-migration) generate loses user attribute read/write restrictions #14748

@dgandhi62

Description

@dgandhi62

How did you install the Amplify CLI?

No response

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

NA

What operating system are you using?

NA

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

  • NA

Describe the bug

When migrating from Amplify Gen 1 to Gen 2, the following Cognito user attribute configurations were lost:

Initial State (Gen 1 — cli-inputs.json):

  • Sign-in method: Username
  • Required for signup: email
  • Auto-verified: email
  • MFA: OFF
  • Password policy: min 12 chars, requires lowercase, numbers, symbols
  • Identity pool: enabled, unauthenticated access disabled
  • Refresh token validity: 30 days
  • App client read attributes: birthdate, email
  • App client write attributes: address, email
  • No OAuth, no Lambda triggers, no user pool groups

Current State (Gen 2 — resource.ts + backend.ts):

  • Sign-in method: Username (set via usernameAttributes = undefined override) ✅
  • Required for signup: email ✅
  • Auto-verified: email ✅
  • MFA: OFF ✅
  • Password policy: min 12 chars, requires lowercase, numbers, symbols (set via CFN override) ✅
  • Identity pool: enabled, unauthenticated access disabled ✅
  • Refresh token validity: 30 days (set via custom app client) ✅
  • App client read attributes: not configured ❌
  • App client write attributes: not configured ❌
  • birthdate attribute: not declared in userAttributes ❌
  • address attribute: not declared in userAttributes ❌

What's missing:

  • birthdate and address are not declared in userAttributes in resource.ts, so they won't be available on the user pool.
  • The custom NativeAppClient in backend.ts does not specify readAttributes or writeAttributes, so the read/write restrictions from Gen 1 are not carried over.

Expected behavior

The Gen 2 config should declare birthdate (read-only) and address (writable) in userAttributes, and the app client should restrict read attributes to birthdate and email, and write attributes to address and email — matching the original Gen 1 configuration.

Reproduction steps

nA

Project Identifier

No response

Log output

Details
# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions