Expose graphql errors
Closed this issue ยท 13 comments
Using this library i got the following error when trying to run an graphql-express
server:
GraphQLError: Syntax Error: Cannot parse the unexpected character "/".
Using a typedefs as a string and using only graphql-tools
i got the following error:
Error: "login" defined in resolvers, but not in schema
Much easier to understand what went wrong.
Is it possible to expose these kinds of errors to the user when using graphql-import
?
The only thing graphql-import
does is process # import
statements in schemas. I think this question should go into graphql-yoga
, if you are experiencing it there.
I found out what the issue was.
it seems that between v0.1.9
and version v0.3.1
you stopped supporting .graphqls
files and only support .graphql
files.
It's the added isFile()
check found here that checks if the file has graphql
extension name.
Got the same error. Very confusing error message. Please add support for .gql
extension as well.
I'm honestly not a big fan of supporting .gql
as well. Are there any other languages that do so as well? I worry this could be confusing to beginners who now will think "hmm, that's the difference between .graphql
and .gql
".
@kbrandwijk JS GraphQL plugin for Webstorm.
@schickling Supporting multiple extensions would not be confusing to beginners, if all the docs and gettings starteds just use .graphql
as extension.
However, for more advanced users integrating this, that have existing files with a different extension, I see no harm in supporting it.
Actually, as far as I'm concerned, everything with a .
in it could be considered a file.
I was using comments with //
instead of #
and that was causing the error...
@kbrandwijk .graphqls seems to be the standard for a backend we are using built on graphql-java-tools
@ https://github.com/graphql-java-kickstart/graphql-java-tools
EDIT: I am assuming this file extension .graphqls
is not supported in this package?
EDIT 2: @nexxado Were you able to figure out how to import .graphqls files at all?
I've just been stuck on this error for over an hour. Why do you even care what the file extension is? I'm telling the package my schema is in that file, the extension of that file is not important and should not be validated.
Hi @jloveric , @TobiasBales , @wingertge , @jsonmaur and @SachaG !
In 1.0.0 beta release, we introduced a lot of changes including different methods to load your schema such as URL Endpoint, graphql/gql files, TS/JS code files, Prisma endpoint, Apollo Engine and JSON files. And those files and sources of schema are parsed and validated in different ways thanks to GraphQL Toolkit which is used by the new version of GraphQL Import behind the scene
Could you install graphql-import@beta
to try new changes? Don't forget to modify your code regarding to the migration notes in README
.
https://github.com/ardatan/graphql-import#updating-from-07x
Available in 1.0.0!