{"action":"created","issue":{"url":"https://api.github.com/repos/graphql/graphql-js/issues/1223","repository_url":"https://api.github.com/repos/graphql/graphql-js","labels_url":"https://api.github.com/repos/graphql/graphql-js/issues/1223/labels{/name}","comments_url":"https://api.github.com/repos/graphql/graphql-js/issues/1223/comments","events_url":"https://api.github.com/repos/graphql/graphql-js/issues/1223/events","html_url":"https://github.com/graphql/graphql-js/issues/1223","id":294144857,"number":1223,"title":"unhandled promise rejection","user":{"login":"joshribakoff","id":4021306,"avatar_url":"https://avatars0.githubusercontent.com/u/4021306?v=4","gravatar_id":"","url":"https://api.github.com/users/joshribakoff","html_url":"https://github.com/joshribakoff","followers_url":"https://api.github.com/users/joshribakoff/followers","following_url":"https://api.github.com/users/joshribakoff/following{/other_user}","gists_url":"https://api.github.com/users/joshribakoff/gists{/gist_id}","starred_url":"https://api.github.com/users/joshribakoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshribakoff/subscriptions","organizations_url":"https://api.github.com/users/joshribakoff/orgs","repos_url":"https://api.github.com/users/joshribakoff/repos","events_url":"https://api.github.com/users/joshribakoff/events{/privacy}","received_events_url":"https://api.github.com/users/joshribakoff/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-02-03T21:02:44Z","updated_at":"2018-02-06T02:44:14Z","closed_at":null,"author_association":"NONE","body":"In my resolver I return a native Promise, in the executor function I access a variable that was not declared. When I make requests from graphiql that invoke my resolver, I get errors in my terminal about unhandled promise rejections & my http request is left spinning (unterminated). After 60s I get a 504 timeout from nginx which I have reverse proxying traffic to my nodeJS process. Using express-graphql 0.6.11 with graphql-tools  1.2.3 to separate my schema & resolvers.\r\n\r\nThis is undesirable default for a graphQL server implementation over HTTP behavior because easy to miss mistakes result in a degraded performance on the frontend where the user is waiting maybe 60s for nginx to time out  before eventually getting feedback in the UI that something went wrong. Instead, I expect a graphQL implementation to terminate the user's http request as soon as a failure is known, ideally null out that field in the response with graphQL errors response, and rethrow the error (so still trigger an unhandled promise rejection or some kind of error I can catch in a higher context).\r\n\r\nI'd be surprised if there isn't also some sort of memory leak / attack surface here, since requests are left sitting open & seemingly never terminated."},"comment":{"url":"https://api.github.com/repos/graphql/graphql-js/issues/comments/363292499","html_url":"https://github.com/graphql/graphql-js/issues/1223#issuecomment-363292499","issue_url":"https://api.github.com/repos/graphql/graphql-js/issues/1223","id":363292499,"user":{"login":"leebyron","id":50130,"avatar_url":"https://avatars3.githubusercontent.com/u/50130?v=4","gravatar_id":"","url":"https://api.github.com/users/leebyron","html_url":"https://github.com/leebyron","followers_url":"https://api.github.com/users/leebyron/followers","following_url":"https://api.github.com/users/leebyron/following{/other_user}","gists_url":"https://api.github.com/users/leebyron/gists{/gist_id}","starred_url":"https://api.github.com/users/leebyron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leebyron/subscriptions","organizations_url":"https://api.github.com/users/leebyron/orgs","repos_url":"https://api.github.com/users/leebyron/repos","events_url":"https://api.github.com/users/leebyron/events{/privacy}","received_events_url":"https://api.github.com/users/leebyron/received_events","type":"User","site_admin":false},"created_at":"2018-02-06T02:44:14Z","updated_at":"2018-02-06T02:44:14Z","author_association":"CONTRIBUTOR","body":"> Also have you considered about pending backend requests? \r\n\r\nCancellation of pending backend requests to a connection is a general problem beyond GraphQL, but I think whatever solution the community agrees upon will be happily adopted. I see promise in cancellation tokens (https://github.com/tc39/proposal-cancellation) and abort controllers (https://developers.google.com/web/updates/2017/09/abortable-fetch) - both of which can be implemented in user space (and supplied via GraphQL context)."}}
{"actor":{"display_login":"leebyron"}}