optional connection causes non-retrieval of non-optional connections
Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug A clear and concise description of what the bug is.
A model with required (non-optional) connections stops retrieving data when a optional connection with generated key is added to the model.
Example (working):
type User @model(subscriptions: null) {
id: ID!
name: String!
taskID: ID!
task: Task @connection(fields: ["taskID"])
}
The above model with the generated listUsers query works as expected.
Changing the model to the below causes "task" data to not be retrieved
type User @model(subscriptions: null) {
id: ID!
name: String!
taskID: ID!
task: Task @connection(fields: ["taskID"])
userNoteID: ID
note: Note @connection
}
Amplify CLI Version
You can use amplify -v to check the amplify cli version on your system
4.29.3
To Reproduce Steps to reproduce the behavior or terminal output if applicable
Create 1st model, add data and run query in app change model, push and then run query and no connection data is retrieved
Expected behavior A clear and concise description of what you expected to happen.
Expect the query to return all data
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Mac/Windows/Ubuntu]
- Node Version. You can use
node -vto check the node version on your system
Win 10 x64 Node 14
Additional context Add any other context about the problem here.
Any updates?
@frankclaassen Are you still experiencing issues with this? I tried to repro this with the following schema in version 4.30
type User @model(subscriptions: null) {
id: ID!
name: String!
taskID: ID!
task: Task @connection(fields: ["taskID"])
userNoteID: ID
note: Note @connection
}
type Task @model {
id: ID
name: String!
description: String
}
# add note on the 2nd push
type Note @model {
id: ID
name: String!
}
Upon running listUsers I was able to get the data from notes and tasks. Is there a specific query you ran which resulted in an empty response?
@SwaySway seems to be working fine in the latest update, closing for now
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.