-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When use string file path for typeDefs,there is a error: Cannot parse the unexpected character "/". #362
Comments
let me see your schema.graphql |
Please I am having similar challenges, has the issue been resolved. If it has, how was it resolved? |
I am having the same issue.. has anyone figured it out? |
same issue as well, has the problem solved? |
same |
quite new to graphql but this error happens when this file "./src/schema.graphql" is empty ..a type must be created & also a mutation & resolver |
I am getting this error and it seems to have something to do with reading the token although I am using syntax defined in the prisma-auth example here's the full output:
prisma generated just fine so I don't think it has anything to do with the schema or datamodel utils.js file from the prisma-auth example:
and the index.js:
|
wondering how to get a more useful error output... vs code usually catches syntax errors in code so I don't think it's that |
can i see the content of schema.graphql .. is it an empty file? if yes then it shouldn't be |
No, and I have also imported everything from my prisma-client. prisma generate would not run with an empty file. Prisma deploys just fine. here it is:
|
It seems to have something to do with parsing the token |
Any updates to this? I really need to get my graphql server up and running. |
Same here... that's strange. Maybe node version related. I worked around it by reading file contents and passing it to typedefs option, as if it was inlined in the code. Also I'm using ".graphqls" etension. const typeDefs = fs.readFileSync('./src/schema.graphqls','utf8');
...
const server = new GraphQLServer({
typeDefs,
resolvers
}); I suspect it's failing to reconize the argument as as filepath for some reason, so it tries to parse the path as actual graphql schema. |
I managed to solve problem:
And in file graph.graphql first line should be:
|
same issue with me! |
@AmrAlmagic
and schema.graphql
|
@tiagobnobrega |
I solved it !!. |
Due to inactivity of this issue we have marked it |
Hey 👋, It seems like this issue has been inactive for some time. In need for maintaining clear overview of the issues concerning the latest version of |
Hello, new to GraphQL but was able to figure this out. Basically, I had a javascript syntax comment on schema.graphql file:
Once I removed the comment, the error was gone. I guess the |
This solved a similar issue for me:
|
Hey, @Urigo from The Guild here! You might know us from projects such as graphql-code-generator, envelop or graphql-tools. For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server. In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀 We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here. Please try Yoga out again, give us feedback and help us spread the word on the new release! |
When use string file path for typeDefs,there is a error:
/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/lexer.js:302
throw (0, _error.syntaxError)(source, pos, unexpectedCharacterMessage(code));
^
GraphQLError: Syntax Error: Cannot parse the unexpected character "/".
at syntaxError (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/error/syntaxError.js:24:10)
at readToken (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/lexer.js:302:32)
at Object.lookahead (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/lexer.js:61:43)
at Object.advanceLexer [as advance] (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/lexer.js:52:33)
at expect (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/parser.js:1296:11)
at parseDocument (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/parser.js:107:3)
at Object.parse (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql/language/parser.js:38:10)
at getDocumentFromSDL (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql-import/dist/index.js:107:26)
at Object.importSchema (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql-import/dist/index.js:59:20)
at mergeTypeDefs (/Users/harry/reactworkspace/graphql-yoga-server/hackernews-node/node_modules/graphql-yoga/dist/index.js:402:37)
The text was updated successfully, but these errors were encountered: