xcode: Version 14.1 (14B47b)
amplify-cli: 10.5.2
posts cannot be fetched using this project as-is.
the schema in HEAD gives me this error:
2022-12-20 22:42:59.062248-0400 PhotoSharingSample[75767:4147505] [ProcessMutationErrorFromCloudOperation] GraphQLError missing extensions and errorType GraphQLError(message: "The variables input contains a field name \'posts\' that is not defined for input object type \'CreateUserInput\' ", locations: nil, path: nil, extensions: nil)
2022-12-20 22:42:59.062672-0400 PhotoSharingSample[75767:4147505] [Amplify] The operation couldn’t be completed. (Amplify.DataStoreError error 0.)
I tried changing the schema to:
type Post
@model
@auth(rules: [{ allow: owner, provider: userPools, operations: [read, create, update, delete] }]) {
id: ID!
postBody: String!
pictureKey: String!
createdAt: AWSDateTime!
userID: ID! @index(name: "byUser", queryField: "postByOwner")
postedBy: User! @belongsTo(fields: ["userID"])
}
type User
@model
@auth(rules: [{ allow: owner, provider: userPools, operations: [read, create, update, delete] }]) {
id: ID!
username: String!
profilePic: String!
posts: [Post] @hasMany(indexName: "byUser", fields:["id"])
}
but now i'm getting this error:
2022-12-20 23:22:30.666685-0400 PhotoSharingSample[78129:4181911] [AWSDataStorePlugin] StorageEngine completed with error: DataStoreError: One or more errors occurred syncing models. See below for detailed error description.
Recovery suggestion: DataStoreError: An error occurred syncing Post
Caused by:
DataStoreError: failed to process graphqlResponseData
Caused by:
APIError: failed to process graphqlResponseData
Caused by:
DataStoreError: The key `__typename` was not found
Recovery suggestion: Check if the parsed JSON contains the expected `__typename`
Caused by:
DataStoreError: One or more errors occurred syncing models. See below for detailed error description.
Recovery suggestion: DataStoreError: An error occurred syncing Post
Caused by:
DataStoreError: failed to process graphqlResponseData
Caused by:
APIError: failed to process graphqlResponseData
Caused by:
DataStoreError: The key `__typename` was not found
Recovery suggestion: Check if the parsed JSON contains the expected `__typename`
i'm out of my depth here as I don't know graphql schema nor DataStore nor swift. 🙏
cc @ruiguoamz