-
Notifications
You must be signed in to change notification settings - Fork 470
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
client:push
operation is re-ordering document definitions
#986
Comments
client:push
operation is re-ordering operation nodesclient:push
operation is re-ordering document definitions
See apollographql/apollo-server#2282 for initial work and tracking progress. Once this PR lands, transitive dependencies will need to be updated to use the new |
This should be fixed via #1027. Anyone who is experiencing this problem (which appears to be a fair number, based on 👍 s!) should:
We encourage anyone who is an Apollo Engine plan which includes the operation registry can reach out on Intercom support for help in this upgrade process and someone will be happy to assist. |
cc @ctbradley |
The problem lies here:
apollo-tooling/packages/apollo-language-server/src/project/client.ts
Lines 323 to 333 in b6dde38
The order of the definitions is changed, and then the result is hashed. When we use
apollo-server-plugin-operation-registry
and turn onforbidUnregisteredOperations
(https://www.apollographql.com/docs/platform/operation-registry.html#Installation-steps), the operation is received in it's original order, hashed, and then compared. If the order does not match, the operation will be rejected.Side note: It might be possible that we're relying on
apollo-server
'ssortAST
to correctly order the AST. Looking at that function, unless I'm reading it incorrectly, it does not re-order operations, but instead normalizes content inside them.https://github.com/apollographql/apollo-server/blob/master/packages/apollo-graphql/src/transforms.ts#L97-L151
Two possible solutions:
Find a way to maintain the original order of the definitions in the original document. This could easily be tested, even though it might be harder to implement.
The operation registry has the luxury the browser interpolating the gql at runtime.
Change
sortAST
to sort thedefinition
s in adocument
. I don't know what the ramifications of this would be.The text was updated successfully, but these errors were encountered: