aws-amplify / aws-amplify/amplify-cli

gen2-migration lock fails with "Unable to find nested stack logical id prefix: AmplifyDataStore"

Open
#14,970 0 comments 0 reactions 0 assignees View on GitHub
pending-triage
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### How did you install the Amplify CLI?

npm

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

v24.19.0

### Amplify CLI Version

14.5.1

### What operating system are you using?

Mac

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

No manual changes made

### Describe the bug

I am migrating an existing Amplify Gen 1 backend to Gen 2.

The migration assessment succeeds, but `amplify gen2-migration lock`
fails during planning with:

→ Planning failed

Unable to find nested stack logical id prefix: AmplifyDataStore

`--skip-validations` fails with the same planning error:

amplify gen2-migration lock --skip-validations

The API currently has DataStore conflict detection disabled.

`amplify update api` reports:

Conflict detection (required for DataStore)
- Disabled

The API's cli-inputs.json contains:

"conflictResolution": {
"defaultResolutionStrategy": {
"type": "NONE"
}
}

However, running a fresh:

amplify api gql-compile

still generates these resources directly in the API CloudFormation
template:

- DataStore (AWS::DynamoDB::Table)
- AmplifyDataStoreIAMRole8DE05A49 (AWS::IAM::Role)

The deployed API nested stack also contains these resources directly:

LogicalResourceId: AmplifyDataStoreIAMRole8DE05A49
ResourceType: AWS::IAM::Role

LogicalResourceId: DataStore
ResourceType: AWS::DynamoDB::Table

There is NOT an AWS::CloudFormation::Stack resource whose logical ID
begins with AmplifyDataStore.

It appears that `gen2-migration lock` expects AmplifyDataStore to be a
nested CloudFormation stack, but this older Gen 1 backend has the
DataStore resources directly inside the API nested stack.

Migration assessment:

api / AppSync / FinalScore
Generate: supported
Refactor: not needed

auth / Cognito / FinalScore
Generate: supported
Refactor: supported

function / Lambda / answerReceived
Generate: requires adding code after generate

Advanced feature:
conflict-resolution
"conflict resolution (DataStore) is not supported in Gen2"

The actual conflict resolution setting is NONE / Disabled.

This migration was first tested successfully using a cloned Gen 1
environment created with `amplify env add`, following the recommended
migration workflow. The issue occurs when migrating the original
environment.

Is this API/DataStore CloudFormation layout supported by
`gen2-migration lock`?

Is there a supported way to migrate this backend without manually
altering/deleting the DataStore table or IAM role?

### Expected behavior

migration would pass successfully

### Reproduction steps

I do not expect running these exact steps in an empty directory will demonstate this behavior.

### Project Identifier

16e60365e8d51c9d6921db8d2d9163b5

### Log output

```
# Put your logs below this line
amplify gen2-migration lock --skip-validations

⚠️ WARNING: AWS Amplify Gen 1 CLI is in maintenance mode and will reach end of life on May 1, 2027.
During maintenance mode, only critical bug fixes and security patches will be provided.
Migrate to Amplify Gen 2: https://docs.amplify.aws/react/start/migrate-to-gen2/

→ Planning failed

🛑 Unable to find nested stack logical id prefix: AmplifyDataStore

Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/

```

### Additional information

_No response_

### Before submitting, please confirm:

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

Contributor guide

Open the contributing guide

Research direction

Start with `amplify gen2-migration lock --skip-validations` and inspect the migration planning path for the `AmplifyDataStore` nested-stack lookup. Compare the API `cli-inputs.json` conflictResolution setting with the resources produced by `amplify api gql-compile` and the deployed API nested stack. Done means the existing layout is handled without manually altering or deleting the DataStore table or IAM role, and migration planning completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.