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

Hangs when a "Long Stack Trace" gets returned with GraphQLNonNull #475

Closed
jsonmaur opened this issue Sep 2, 2016 · 3 comments
Closed

Hangs when a "Long Stack Trace" gets returned with GraphQLNonNull #475

jsonmaur opened this issue Sep 2, 2016 · 3 comments

Comments

@jsonmaur
Copy link

jsonmaur commented Sep 2, 2016

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, when NODE_ENV is set to development, they return "long stack traces". These can be disabled with BLUEBIRD_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.

@robzhu
Copy link
Contributor

robzhu commented Nov 3, 2016

Hey @jsonmaur are you still hitting this issue? Have you found a workaround?

@jsonmaur
Copy link
Author

I haven't had a chance to test it with the latest graphql version yet. I worked around it by setting the environment variable BLUEBIRD_LONG_STACK_TRACES=0 in my server. If I get some time next week I'll see if it's still an issue.

Any idea what it could be?

@robzhu
Copy link
Contributor

robzhu commented Nov 14, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants