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

Apollo Server Express with stitched schema swallows errors #2448

Closed
GarethSharpe opened this issue Mar 15, 2019 · 1 comment
Closed

Apollo Server Express with stitched schema swallows errors #2448

GarethSharpe opened this issue Mar 15, 2019 · 1 comment

Comments

@GarethSharpe
Copy link

Intended outcome

When using a GraphQL gateway to schema stitch GraphQL µservices, the error messages thrown by the µservices should bubble up to the gateway and should be presented unaltered.

Actual outcome

A generic INTERNAL_SERVER_ERROR error code is displayed to the gateway client along with a message containing an `[object Object] which cannot be extracted. The µservice throws the correct error.

µservice error:

{ [GraphQLError: Session expired or invalid]
  message: 'Session expired or invalid',
  locations: [ { line: x, column: x } ],
  path: [ 'xxx' ],
  extensions: 
   { code: 'INTERNAL_SERVER_ERROR',
     exception: 
      { name: 'INVALID_SESSION_ID',
        errorCode: 'INVALID_SESSION_ID',
        stacktrace: [Array] } } }

gateway error:

{ [GraphQLError: [object Object]]
  message: '[object Object]',
  locations: [ { line: x, column: x } ],
  path: [ 'xxx' ],
  extensions: 
   { code: 'INTERNAL_SERVER_ERROR',
     exception: { errors: [Array], stacktrace: [Array] } } }

How to reproduce the issue

Stitch two schemas together. Force one to throw a specific error (AutenticationError, etc). Observe response from the Apollo Server that stitched the schemas.

Potential fix

Move to graphql-tools@next (5.0.0-rc.0). Here is the ongoing discussion.

@martijnwalraven
Copy link
Contributor

Closing this because it will have to be resolved in graphql-tools, but note that schema stitching is being deprecated in favor of federation.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants