react-relay
react-relay copied to clipboard
1-getting-started schema error with graphcool init
(Using graphcool 0.4)
After running:
graphcool init --schema https://graphqlbin.com/hn-relay.graphql --name Hackernews
I run into this error:
The relation field
links has 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.
I bet everything is not up to date.
I'm getting the same thing as well. Any suggestions?
@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:
-
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. -
In the
types.graphql
root file, change the schema to the following (note: theFile
&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")
}
- run
graphcool login
to login (opens your browser for authentication) - run
graphcool playground
Hope it help