Git Product home page Git Product logo

apollo-link-http's Introduction

Fork of @apollo-link-http

Why Fork?

There is at this time a bug in apollo-link-http.

When connecting to another Apollo Server using apollo-link-http and receiving an error, there are a number of possible cases.

  • You receive a network error e.g. something like a HTTP 500
  • You receive a GraphQL Error { errors: [ ... ] }
  • You receive BOTH; a GraphQL Error with a network error

The final case, where you will receive both a graphql error and network error is not properly handled by apollo-link-http.

An example of this kind of unique error is a parse error which Apollo uniquely treats as a network error + graphql error. We were able to simulate this by for example using an invalid Date format which couldn't be parsed. The parser is pre-GraphQL so it seems to be considered a network error.

HOWEVER The code to handle this case is present but its inside an if block with an error in the condition that prevents the code from ever running. Perhaps this used to work with a legacy version of Apollo and has broken.

This means that in this event of a combined network/graphql Error, the GraphQL Error is not emitted to observables. Since this doesn't happen, other links in the chain cannot handle the error.

This has the final consequence of basically breaking schema-stitching. When a stitched schema returns such an error, you WANT the GraphQL Error to be stitched into your errors section even if there is also a network error (non-200 code) but it is not. This leads to much confusion / swallowed errors, when one service among many that you are stitching retuns such an error.

Hopefully this is eventually solved, but for now, this is a 1 line patch/fork that I will submit to Apollo's team.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.