-
Notifications
You must be signed in to change notification settings - Fork 2k
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
core: return PersistedQueryNotSupported for Apollo Persisted Queries #982
Conversation
Apollo Persisted Queries is a standard for sending queries as short hashes instead of full strings, designed to work well with GET requests. It is implemented by servers including the Apollo Engine Proxy, and by the apollo-link-persisted-query client. A common configuration is to set up persisted queries on production servers but not in development. It is still convenient to leave apollo-link-persisted-query always on, though. While apollo-link-persisted-query can detect that servers don't support PQs, it works better if the server actually says it doesn't support the PQ, instead of trying to process a request without a query and potentially printing a confusing stack trace. This commit makes apollo-server directly return PersistedQueryNotSupported instead of allowing confusing stack traces to occur.
Thanks! In the future I prefer to merge my own PRs on repos where I have permissions, as l'esprit de l'escalier often strikes me. (I was at least intending to add a CHANGELOG note here.) |
This has been published as apollo-server-* 1.3.6. |
OK When calling to get a persisted query I get an error when Graphql does not have Engine defined. 1: Then: { Stack dump is: graphql_1 | TypeError: Cannot read property 'definitions' of undefined It should probably say: message: "Graphql Apollo Engine APQ is not enabled" |
You are definitely running [email protected]? |
I am running "apollo-engine": "^1.1.0", |
But what version of |
npm ls | grep apollo-server-core |
That's strange — this PR really should fix that. Can you share a small reproduction git repo that shows this happening? |
Apollo Persisted Queries is a standard for sending queries as short hashes
instead of full strings, designed to work well with GET requests. It is
implemented by servers including the Apollo Engine Proxy, and by the
apollo-link-persisted-query client.
A common configuration is to set up persisted queries on production servers but
not in development. It is still convenient to leave apollo-link-persisted-query
always on, though. While apollo-link-persisted-query can detect that servers
don't support PQs, it works better if the server actually says it doesn't
support the PQ, instead of trying to process a request without a query and
potentially printing a confusing stack trace. This commit makes apollo-server
directly return PersistedQueryNotSupported instead of allowing confusing stack
traces to occur.