When i use:
await DataStore.save(
new User({
firstname: "John",
lastname: "Doe"
})
)
The request to the graphql api in appsync contains: userStatusId: null. I don麓t want that field at the time of creating a user. So how do i get rid of it? A user can have one status. A status can be in many users. When i query with DataStore.query(User) I麓d like to have all the relational fields like status in it. This parts works when using the schema below.
type User @model {
id: ID!
firstname: String
lastname: String!
status: Status @connection(name: "StatusUsers")
}
type Status @model {
id: ID!
users: [User] @connection(name: "StatusUsers")
name: String
}
thanks
Hi! I have reported the same new API/Datastore plugins behaviour miss-alignment here: https://github.com/aws-amplify/amplify-cli/issues/3109
@benjamin79 Where are you getting the Type mismatch index key error? Do you have sample code or repo?
I get the error in the browser console when i run Datastore.save... You just can add the models above from a project you already have and run the Datastore.save and you see the error. But i can make a repo next week if you still need it.
Don麓t you think it might be the reason what Soek22 described?
@ashika01 I am getting exactly same error on Amplify-iOS plugin, as stated here: https://github.com/aws-amplify/amplify-ios/issues/284 (with references to the source code where the problem is located)
I think it is a behaviour miss-alignment that breaks previously deployed backends, making them unable to work with the new API/Datastore plugins. Because of that, I have opened a more "generic" issue on the amplify-cli repo: https://github.com/aws-amplify/amplify-cli/issues/3109
Thanks, we'll look into this together with the CLI to better support previously deployed backends
Closing this issue since it has to be tracked from Amplify CLI. https://github.com/aws-amplify/amplify-cli/issues/3109.