Skip to content

unhandled promise rejection #1223

Closed
Closed
@joshribakoff

Description

@joshribakoff

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.

This 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).

I'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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions