I am getting the following error when running relay-compiler in my project
$ get-graphql-schema http://localhost/api/office > schema.graphql
$ relay-compiler --src ./src/client --schema schema.graphql
Watchman: Watchman was not found in PATH. See https://facebook.github.io/watchman/docs/install.html for installation instructions
HINT: pass --watch to keep watching for changes.
Writing js
ERROR:
Expected undefined to be a GraphQL leaf type.
error Command failed with exit code 100.
Any suggestions on how to go about debugging this, the only recent change in my project (famous last words) was upgrading to relay 1.5. I suspect it is something in the graphql schema that needs to change to fit within the new relay-compiler, but I am not seeing it.
The schema.graphql is below:
schema {
query: RootQuery
mutation: RootMutation
}
type Delete {
n: String
nModified: String
ok: String
}
type Room {
_uuid: String
roomName: String
serviceName: String
roomURL: String
roomID: String
phoneNumber1: String
phoneNumber2: String
participantCode: String
moderatorCode: String
video: String
otherLink1: String
otherLink2: String
color: String
}
# Mutation interface
type RootMutation {
createRoom(
# Name of the room owner
ownerName: String
# Email of the room owner
ownerEmail: String!
# Name of the room
roomName: String!
# Service name
serviceName: String!
# URL
roomURL: String!
# ID to meeting room
roomID: String
# Phone number 1
phoneNumber1: String!
# Phone number 2
phoneNumber2: String
# Participant code
participantCode: String!
# Moderator code
moderatorCode: String!
# Video
video: String
# Color
color: String
): Room
deleteRoom(
# Email of the room owner
ownerEmail: String!
# Name of the room
roomName: String!
): Delete
}
type RootQuery {
meetingsUser(ownerEmail: String!, _uuid: String, refetch: Boolean): [User]
}
type User {
_id: String
ownerEmail: String
ownerName: String
# Provides a list of all rooms owned by the user
rooms: Room
}
This is because you are missing global id field on your type.
I had the same issue, but adding
type MyType = {
id: ID
...
}
solved the problem.
See also https://github.com/facebook/relay/issues/1880#issuecomment-307705428