Skip to content
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

Expose graphql errors #39

Closed
ndraiman opened this issue Jan 10, 2018 · 13 comments
Closed

Expose graphql errors #39

ndraiman opened this issue Jan 10, 2018 · 13 comments

Comments

@ndraiman
Copy link

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?

@kbrandwijk
Copy link
Contributor

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.

@ndraiman
Copy link
Author

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.

@koliyo
Copy link

koliyo commented Feb 19, 2018

Got the same error. Very confusing error message. Please add support for .gql extension as well.

@kbrandwijk
Copy link
Contributor

@koliyo I agree to supporting .gql.
@nexxado I don't think .graphqls is a standard extension. Where is that used?

@schickling
Copy link
Contributor

schickling commented Feb 19, 2018

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".

@ndraiman
Copy link
Author

@kbrandwijk JS GraphQL plugin for Webstorm.

screenshot_1

@kbrandwijk
Copy link
Contributor

kbrandwijk commented Feb 19, 2018

@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.

@vasco3
Copy link

vasco3 commented Aug 5, 2018

I was using comments with // instead of # and that was causing the error...

@DanceParty
Copy link

DanceParty commented Oct 12, 2018

@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?

@zzzgit
Copy link

zzzgit commented Nov 28, 2018

OK, OK
If you guys don't want to make this tool to support .gql files, please add some more details to the error info.

image

This is what I currently get, no one knows what it means.

@Glen-Moonpig
Copy link

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.

@ardatan
Copy link
Owner

ardatan commented Dec 31, 2019

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

@ardatan
Copy link
Owner

ardatan commented Mar 17, 2020

Available in 1.0.0!

@ardatan ardatan closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants