howtographql / react-relay

46 stars 17 forks source link

1-getting-started schema error with graphcool init #6

Open GordanRatkovic opened 6 years ago

GordanRatkovic commented 6 years ago

(Using graphcool 0.4) After running: graphcool init --schema https://graphqlbin.com/hn-relay.graphql --name Hackernews I run into this error: The relation fieldlinkshas the wrong format: [Link!] Possible Formats: Link, Link!, [Link!]!

I created a local copy of hn-relay.graphql and replaced [Link!] with [Link!]! as well as [Vote!] with [Vote!]!. It solved the issue.

JonathanSum commented 6 years ago

I bet everything is not up to date.

maryjenel commented 6 years ago

I'm getting the same thing as well. Any suggestions?

levitomer commented 4 years ago

@GordanRatkovic - I've noticed there are lots of changes in the last revision of graphcool which needs different acts to be done in order for the tutorial to work as expected:

  1. runing graphcool deploy will create an .graphcool.rc which (later) will contain the project cluster id in order to deploy the app in a docker.

  2. In the types.graphql root file, change the schema to the following (note: the File & User type is important since its a system type):

    
    type File @model {
    contentType: String!
    createdAt: DateTime!
    id: ID! @isUnique
    name: String!
    secret: String! @isUnique
    size: Int!
    updatedAt: DateTime!
    url: String! @isUnique
    }

type User @model { id: ID! @isUnique createdAt: DateTime! updatedAt: DateTime! name: String! links: [Link!]! @relation(name: "UsersLinks") votes: [Vote!]! @relation(name: "UsersVotes") }

type Link @model { id: ID! @isUnique createdAt: DateTime! updatedAt: DateTime! url: String! description: String! postedBy: User @relation(name: "UsersLinks") votes: [Vote!]! @relation(name: "VotesOnLink") }

type Vote @model { id: ID! @isUnique createdAt: DateTime! updatedAt: DateTime! user: User @relation(name: "UsersVotes") link: Link @relation(name: "VotesOnLink") }



3. run `graphcool login` to login (opens your browser for authentication)
4. run `graphcool playground`

Hope it help