Giter Club home page Giter Club logo

amplify-ios-samples's Issues

graphql schema issues...

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.