Removing named connections graphql API
See original GitHub issueDescribe the bug
Removing named connections of models throws Cannot perform more than one GSI creation or deletion in a single update
. Someone who hasn’t experienced this would think that he/she needs to remove those one by one, but doing so will throw Found one half of connection "<ModelName>" at <ModelName>.<field> but no related field on type <ModelName>
.
To Reproduce Steps to reproduce the behavior:
- Create a two models, that look like so:
type ModelOne
@model
@searchable
@auth(rules: [{ allow: public, provider: apiKey }, { allow: private }]) { {
id: ID!
testField: String
modelTwo: ModelTwo @connection(name: "ModelOneTwoConnection", keyField: "modelOneId")
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
type ModelTwo
@model
@searchable
@auth(rules: [{ allow: public, provider: apiKey }, { allow: private }]) { {
id: ID!
modelOneId: String
testFieldAgain: String
modelOne: ModelOne @connection(name: "ModelOneTwoConnection", keyField: "modelOneId")
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
I tried to push this and the connection didn’t work, modelTwo
field will always be null
when I query ModelOne
, I suppose this could only be done in a “belongsTo” fashion where I have to do this instead:
type ModelOne
@model
@searchable
@auth(rules: [{ allow: public, provider: apiKey }, { allow: private }]) { {
id: ID!
testField: String
modelTwo: [ModelTwo] @connection(name: "ModelOneTwoConnection", keyField: "modelOneId")
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
type ModelTwo
@model
@searchable
@auth(rules: [{ allow: public, provider: apiKey }, { allow: private }]) { {
id: ID!
modelOneId: String
testFieldAgain: String
modelOne: ModelOne @connection(name: "ModelOneTwoConnection", keyField: "modelOneId")
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
But I decided to remove the connection all together to try a different approach.
- Remove the fields with connections.
Expected behavior I’m unsure.
Screenshots N/A
Smartphone (please complete the following information):
- Device: N/A
- OS: MacOS
- Browser N/A
- Version 4.13.1
Additional context Add any other context about the problem here.
Sample code See above.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Hi @aprilmintacpineda this was addressed as a part of sanity checks the CLI implementing when it comes to adding and removing GSI’s in one push. Comment: https://github.com/aws-amplify/amplify-cli/issues/922#issuecomment-509418653
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.