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

delegateToSchema should return the full result with the extensions field for subscriptions #1042

Closed
hotgazpacho opened this issue Jan 13, 2019 · 2 comments

Comments

@hotgazpacho
Copy link

hotgazpacho commented Jan 13, 2019

When returning a response to a subscription document, only the transformed data from the remote schema is returned.

https://github.com/apollographql/graphql-tools/blob/dacfd83566b6d8a9bee61ee1b5cda373b2b531a7/src/stitching/delegateToSchema.ts#L132-L134

This is a problem when the remote schema populates the websocket connection and channel subscription information in the extensions field of the response. I ran into this when attempting to merge a remote AWS AppSync schema into my Apollo Server lambda implementation. The way AWS AppSync implements subscriptions is via their IoT MQTT services. That is, when a request for a subscription comes in, as part of the response, it includes all the information _(such as the wss url, credentials, and channel metadata) in the extensions field in the response. AWS then provides a [SubscriptionHandshakeLink]( https://github.com/awslabs/aws-mobile-appsync-sdk-js/blob/master/packages/aws-appsync/src/link/subscription-handshake-link.ts) in their AppSync SDK that uses this information to extablish the websocket connection.

Without the extensions field being passed back up in the response, the client never receives the connection information.

@ghost
Copy link

ghost commented Jan 21, 2019

This issue affects not only subscriptions, but also things like errors

dotansimha/graphql-binding#173

extensions field is missing when executing GraphQL operations like in https://github.com/graphql-binding/graphql-binding package which also uses delegateToSchema. As a result some sensitive information like Apollo error codes and other parameters stored in extensions are not retrieved when the operation is executed.

@yaacovCR
Copy link
Collaborator

yaacovCR commented Apr 1, 2020

See implementation in #969 using a link.

@yaacovCR yaacovCR closed this as completed Apr 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants