amplify-studio
amplify-studio copied to clipboard
1st Deploy of Data Model fails from Amplify Studio
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
16.13.1
Amplify CLI Version
12.0.3
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 had defined the data model for a new Amplify project and clicked "Deploy" in the Amplify Studio and immediately saw the deploy error message in the UI asking me to report this issue.
Expected behavior
I expected the data model I defined to be created and then deployed.
Reproduction steps
Again, this happened in Amplify Studio, but it asked me to report it here. I defined the data model, then clicked "Deploy" and got the error.
Project Identifier
4188a2e36601ecf00b1a0c9b2e1c7fe2
Log output
# Put your logs below this line
Command failed with exit code 1: amplify add api --headless [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. [WARNING] aws-cdk-lib.CfnResource#addDependsOn is deprecated. use addDependency This API will be removed in the next major release. {"errorName":"UnknownFault","errorMessage":"There is already a Construct with name 'PermissionsRolesPermissionsDataResolverFn' in TransformerNestedStack [ConnectionStack]","resolution":"Please report this issue at https://github.com/aws-amplify/amplify-cli/issues and include the project identifier from: 'amplify diagnose --send-report'","link":"https://docs.amplify.aws/cli/project/troubleshooting/"} Amplify command hooks are disabled in the current execution environment. See https://docs.amplify.aws/cli/usage/command-hooks/ for more information. Session Identifier: 96225e83-3f02-4af4-88f9-1fd29b5a21d4
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.
Hey @daveashworth, 👋 thank you for reaching out. The error message seems to be masked with the CDK warnings
There is already a Construct with name 'PermissionsRolesPermissionsDataResolverFn' in TransformerNestedStack [ConnectionStack]
Does the data model have a many to many relationship? was there a recent change to the data model such as changing the model name or data type on a field? Could you provide your AppID(present in the url or the AWS console) and the data model being utilized?
I will be transferring the issue to studio repository for further assistance.
Hey @ykethan 👋
I do have a few many-to-many relationships in the model, but this was the initial creation step. No pre-existing model. I was trying to define a Permissions and a Roles model with a many-to-many relationship between those two. Unfortunately the overall model wasn't created when I clicked "Deploy" and I'm going to need to create this from scratch again as none of what I defined yesterday exists today in the Studio.
I took a screenshot yesterday before stopping for the day so here's what those two models looked like that I was trying to create.
And I believe this is the App ID if that still helps: d3kodjfp812wgk
Hey @daveashworth, I was able to reproduce the issue. The issue appears due to the naming conflict on Permissions
model relationship. Changing the relationship name from RolesPermissions
to for example Roles
mitigates the issue.
Under the hood when deploying the GraphQL API, it autogenerates resolvers and in the resolvers it appears the API is already creating a resolver function with the name PermissionsRolesPermissionsDataResolverFn
which is causing the conflict.
Ok thank you @ykethan! I will re-create the model and make sure to change the name on that relationship for now.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.