Skip to content

(gen2-migration) generate command sometimes omits dynamo table model mappings #14487

Description

@iliapolo

How did you install the Amplify CLI?

npm install --no-save @aws-amplify/cli-internal-gen2-migration-experimental-alpha

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

No response

Amplify CLI Version

0.4.0

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

Describe the bug

When running npx amplify gen2-migration generate the data resource sometimes looks like this:

export const data = defineData({
  authorizationModes: {
    defaultAuthorizationMode: "iam",
    apiKeyAuthorizationMode: { expiresInDays: 7 }
  },
  schema
});

Its missing the migratedAmplifyGen1DynamoDbTableMappings property which tells amplify which tables should be reused for which model.

Expected behavior

Data resource should always include the mapping if an app has a GraphQL schema:

export const data = defineData({
  migratedAmplifyGen1DynamoDbTableMappings: [{
    //The "branchname" variable needs to be the same as your deployment branch if you want to reuse your Gen1 app tables
    branchName: "main",
    modelNameToTableNameMapping: { User: "User-vzljmnp34bajrbgjzq7gowln6q-main", Product: "Product-vzljmnp34bajrbgjzq7gowln6q-main", Comment: "Comment-vzljmnp34bajrbgjzq7gowln6q-main" }
  }],
  authorizationModes: {
    defaultAuthorizationMode: "iam",
    apiKeyAuthorizationMode: { expiresInDays: 7 }
  },
  schema
});

Reproduction steps

This behavior is sporadic and probably doesn't relate to a specific app. For me though it happened while following the migration guide of the fitness-tracker app

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.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions