You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
model User {
id Int @default(autoincrement()) @id
name String
}
model Post {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
title String
body String
}
Everything is working fine, until I add a relation between posts and users, and try to generate the sdl for them.
model User {
id Int @default(autoincrement()) @id
name String
}
model Post {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
title String
body String
authorId Int
author User @relation(fields: [authorId], references: [id])
}
When running the sdl or scaffold commands, everything looks fine.
api | error GraphQLError: Syntax Error: Expected Name, found [
api | at syntaxError (node_modules/graphql/error/syntaxError.js:15:10)
api | at Parser.expectToken (node_modules/graphql/language/parser.js:1404:40)
api | at Parser.parseName (node_modules/graphql/language/parser.js:94:22)
api | at Parser.parseFieldDefinition (node_modules/graphql/language/parser.js:857:21)
api | at Parser.optionalMany (node_modules/graphql/language/parser.js:1497:28)
api | at Parser.parseFieldsDefinition (node_modules/graphql/language/parser.js:846:17)
api | at Parser.parseObjectTypeDefinition (node_modules/graphql/language/parser.js:798:23)
api | at Parser.parseTypeSystemDefinition (node_modules/graphql/language/parser.js:696:23)
api | at Parser.parseDefinition (node_modules/graphql/language/parser.js:146:23)
api | at Parser.many (node_modules/graphql/language/parser.js:1518:26) {
api | message: 'Syntax Error: Expected Name, found [',
api | locations: [ { line: 7, column: 24 } ]
This seems to cause the /graphql endpoint to fail. I managed to find the culprit in api/src/graphql/users.sdl.js:
Which should be formatted this way instead (from what I understand):
Post: [Post]
In fact, replacing it makes the error disappear and the web and api to serve requests properly again. I then get other errors, when trying to create a post though...
Is it not supported yet? I had a feeling it was, reading #327
Am I doing something wrong? I would love to contribute to the project and make this work, but would need a few pointers...
The text was updated successfully, but these errors were encountered:
I have two models in my schema:
Everything is working fine, until I add a relation between posts and users, and try to generate the sdl for them.
When running the sdl or scaffold commands, everything looks fine.
Until you start the server with:
Then this error appears in the logs:
This seems to cause the
/graphql
endpoint to fail. I managed to find the culprit inapi/src/graphql/users.sdl.js
:Notice this line:
Which should be formatted this way instead (from what I understand):
In fact, replacing it makes the error disappear and the web and api to serve requests properly again. I then get other errors, when trying to create a post though...
Is it not supported yet? I had a feeling it was, reading #327
Am I doing something wrong? I would love to contribute to the project and make this work, but would need a few pointers...
The text was updated successfully, but these errors were encountered: