Error while migrating to GraphQL transformer V2
Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
How did you install the Amplify CLI?
npm i -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
16.13.1
Amplify CLI Version
7.6.13
What operating system are you using?
Windows 11
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
Nil
Amplify Categories
api
Amplify Commands
push
Describe the bug
I was configuring my GraphQL schema and I needed to use the "hasMany" directive. But I realized that I am currently using GraphQL transformer V1, so I went on to switch to V2. I ran "amplify migrate api". And it did make a backup and migrated to V2 fine, and it corrected the "@connection" directive to "@hasOne" etc. But as soon as I ran "amplify push", it stopped and gave me this error: There is already a Construct with name 'AuthCognitoUserPoolId' in TransformerRootStack [transformer-root-stack] Even when I wanted to revert the migration by using "amplify migrate api --revert", it gave the same error.
Expected behavior
Should migrate to V2 and push the changes to the cloud successfully
Reproduction steps
- Make sure you're using GraphQL transformer V1
- Migrate to V2 by running "amplify migrate api"
- Run "amplify push"
GraphQL schema(s)
# Put schemas below this line
type User
@model
@auth(
rules: [
{allow: public, provider: iam, operations: [read]}
{allow: private, operations: [read]}
{allow: owner, operations: [create, delete, update, read]}
]
)
{
id: ID!
username: String
email: String
profileImage: String
firstName: String
lastName: String
phoneNo: String
bio: String
facebook: String
instagram: String
twitter: String
website: String
dateOfBirth: String
publicAddress: String
}
type Nft
@model
@auth(
rules: [
{allow: public, provider: iam, operations: [read]}
{allow: private, operations: [read]}
{allow: owner, operations: [create, delete, update, read]}
]
)
{
id: ID!
title: String!
description: String!
mediaUrl: String!
mediaType: String!
owner: User! @hasOne
category: String!
rating: Int
likes: Int
comment: [Comment] @hasMany
}
type Comment
@model
@auth(
rules: [
{allow: public, provider: iam, operations: [read]}
{allow: private, operations: [read]}
{allow: owner, operations: [create, delete, update, read]}
]
)
{
id: ID!
comment: String!
}
Log output
# Put your logs below this line
🛑 An error occurred during the push operation: There is already a Construct with name 'AuthCognitoUserPoolId' in TransformerRootStack [transformer-root-stack]
Additional information
No response
Hi @Hamza141999, thank you for reporting this issue.
Can you share the V1 schema as it was before running amplify migrate api?
Hi @Hamza141999, following up on this to see if you are experiencing any continued issues with the migration.
Closing due to inactivity