Skip to content

"Thenables" does not necessarily means promise objects - Failing execution on "badly-formed" promises #478

@rricard

Description

@rricard

Some libraries (such as very old mongoose versions) does not use native promises and use an old promise system that for instance won't support the .catch statement. those things are typically "thenable" but not "catchable". The issue here is that GraphQL execution engine considers everything "thenable" as "catchable".

This triggers the following stacktrace:

TypeError: completed.catch is not a function
      at completeValueWithLocatedError (node_modules/graphql/execution/execute.js:493:29)
      at completeValueCatchingError (node_modules/graphql/execution/execute.js:467:21)
      at resolveField (node_modules/graphql/execution/execute.js:440:10)
      at node_modules/graphql/execution/execute.js:219:20
      at process._tickDomainCallback (internal/process/next_tick.js:129:7)

This "bug" isn't really one if you use "real" promises everywhere but is one if you have to deal with legacy systems not quite updated yet.

I will provide a simple fix to this issue if you think it's worth fixing.

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