anyone getting a parse error when importing genera...
# prisma-client
j
anyone getting a parse error when importing generated api into schema.graphql? Keep restarting with the graphql auth/shield example and getting this error:
GraphQLError: Syntax Error: Cannot parse the unexpected character ".".
It goes away when I remove this line from my schema:
# import * from './generated/prisma-client
Used this method for almost a year without issues until recently. Using prisma-client-lib v 1.25.7 Min repo: github.com/jackgray/govtrackr
h
use # import * from './generated/prisma-client/prisma.graphql'
I think you do have a generated schema yet
j
ahhh, thought it read from the index.js file. Thanks! I should also note that I was using this method in the past with prisma-bindings so I guess it's a little different
👍 1
ah @Harshit I am still getting the same error after modification
h
check the generated folder, is there a prisma.graphql file?
j
yeah, I just exclude the generated folder from my commits
h
also it looks like you are missing a
'
from the thing you have pasted
# import * from './generated/prisma-client/prisma.graphql'
try this
j
# import * from './generated/prisma-client/prisma-schema.js' scalar DateTime type Query { me: User feed: [Post!]! filterPosts(searchString: String): [Post!]! post(id: ID!): Post } type Mutation { createDraft(title: String!, content: String): Post! deletePost(id: ID!): Post publish(id: ID!): Post signup(email: String!, password: String!, name: String): AuthPayload! login(email: String!, password: String!): AuthPayload! } type AuthPayload { token: String! user: User! } type Post { id: ID! createdAt: DateTime! updatedAt: DateTime! published: Boolean! title: String! content: String author: User! } type User { id: ID! email: String! name: String posts: [Post!]! }
@Harshit I do not have a prisma.graphql since I'm using the js client, so the file is prisma-schema.js. should be the same, no?
h
You can generate one: Add the follow to the prisma.yml
Copy code
- generate:
    generator: graphql-schema
    output: './generated/prisma-client'
please modify the location.
and run prisma generate
@jackgray
j
are there any docs that can help me understand why both are necessary and the exact function of each? I found this https://github.com/nikolasburk/prisma-client-examples/blob/master/generated/prisma.graphql but was under the impression that the js client was meant to fill this role
if I am exposing the prisma api through my graphql datamodel and using resolver functions that way, does that mean I don't need to generate the js client?
that fixed it though! THANK YOU 🙏
🙌 1
btw your git name makes so much more sense now that I see your full name 😂
😅 1