-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Hangs when a "Long Stack Trace" gets returned with GraphQLNonNull #475
Comments
Hey @jsonmaur are you still hitting this issue? Have you found a workaround? |
I haven't had a chance to test it with the latest graphql version yet. I worked around it by setting the environment variable Any idea what it could be? |
Not sure based on the information you've provided, but it sounds like this is a relatively unique case and you have a workaround to unblock you. Closing the issue, but please re-open if you hit it again and I'll help investigate. |
Okay, so this is a super weird issue that took forever to debug. I'm still not totally sure what's happening, but here it is.
I'm using Knex to query a Postgres database in my resolver. When I have a non-null object type and the resolver returns no rows (undefined) from the database, it should return an error message of
"Cannot return null for non-nullable field RootQueryType.user."
, but instead GraphQL will completely hang. But if the db returns a row, everything works fine. When the object type allows null, it won't hang and instead just return null.This only happens when
NODE_ENV === 'development'
. I dug into this and found out it's coming from Bluebird, the promise library behind Knex. According to this, whenNODE_ENV
is set to development, they return "long stack traces". These can be disabled withBLUEBIRD_LONG_STACK_TRACES=0
, and with that environment variable set, GraphQL will no longer hang when an undefined result comes back from the database.So why would GraphQL hang when a long stack trace is returned from Knex/Bluebird? You can reproduce this issue with the code in this repo. Let me know if you need any more details.
The text was updated successfully, but these errors were encountered: