I'm using this guide,
https://aws-amplify.github.io/docs/js/start?ref=amplify-rn-btn&platform=react-native
I'm getting the error described in the title on step 3 of the tutorial. The following are the steps I took:
Do you want to configure advanced settings for the GraphQL API No, I am done.
Do you have an annotated GraphQL schema? No
Do you want a guided schema creation? Yes
What best describes your project: One-to-many relationship (e.g., “Blogs” with
“Posts” and “Comments”)
Do you want to edit the schema now? No
Having the same issue ...
@AvneeshD, @smn-snkl I think there's an error in the generated schema. Try changing blogID: String!
to blogID: ID!
The default boilerplate generates it with the wrong type. Thanks @srobbin !
Fixed the boilerplate in the Amplify CLI. Changes will be available in the next release.
cc @sammartinez
This seems to be fixed with @jhockett 's PR. @AvneeshD - please reopen this ticket if you can still reproduce.
@renebrandel I am still having this error with this schema and using @aws-amplify/cli version: 4.27.1
type Registration
@model
@key(name: "registrationByDate", fields: ["date"])
# prettier-ignore
@auth(
rules: [
{
allow: owner,
ownerField: "owner",
operations: [create, update, delete, read]
},
{ allow: private}
]
) {
id: ID!
horecaID: ID!
horeca: Horeca! @connection(fields: ["horecaID"])
members: [MemberRegistrations]
@connection(keyName: "byRegistration", fields: ["id"])
date: String!
time: String!
owner: String!
}
type Horeca
@model
@key(fields: ["id", "name"])
@key(name: "horecaByName", fields: ["name", "place"])
@key(name: "horecaByPlace", fields: ["place", "name"])
# prettier-ignore
@auth(rules: [{ allow: owner, ownerField: "owner",operations: [create, update, delete, read] },{ allow: private}]) {
id: ID!
name: String!
place: String!
qr: String
owner: String!
registrations: [Registration]
@connection(keyName: "registrationByDate", fields: ["id"])
}
type Family
@model
@key(name: "byfamilyName", fields: ["familyName"])
# prettier-ignore
@auth(
rules: [
{
allow: owner,
ownerField: "owner",
operations: [create, delete, update, read]
},{ allow: private}
]
) {
id: ID!
familyName: String!
address: String!
phone: String!
members: [Member]! @connection(keyName: "byName", fields: ["id"])
owner: String!
}
type Member
@model
@key(name: "byName", fields: ["familyID", "name"])
# prettier-ignore
@auth(
rules: [
{
allow: owner,
ownerField: "owner",
operations: [create, delete, update, read]
},{ allow: private}
]
) {
id: ID!
familyID: ID!
name: String!
owner: String!
family: Family @connection(fields: ["familyID"])
registrations: [MemberRegistrations]
@connection(keyName: "byMember", fields: ["id"])
}
type MemberRegistrations
@model(queries: null)
@key(name: "byMember", fields: ["memberID", "registrationID"])
@key(name: "byRegistration", fields: ["registrationID", "memberID"]) {
id: ID!
registrationID: ID!
memberID: ID!
registrations: Registration! @connection(fields: ["registrationID"])
members: Member! @connection(fields: ["memberID"])
}
Most helpful comment
@AvneeshD, @smn-snkl I think there's an error in the generated schema. Try changing
blogID: String!
toblogID: ID!