Open SeanDoyleGit opened 3 years ago
It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)
Bug report
info.cacheControl
is undefined in custom queries that are called fromkeystone.executeGraphQL
Describe the bug
Custom queries called from
keystone.executeGraphQL
will haveinfo.cacheControl
be undefined.info.cacheControl
needs to be defined in all custom queries so the correct cache headers are applied.For example if a query has a cache scope of
PUBLIC
and calls another query with a scope ofPRIVATE
this bug will prevent thePRIVATE
scope from being applied and result in the caching of sensitive user information.To Reproduce
Implement the following changes to the blog example in the keystone repo.
run
yarn add apollo-server-express
and addconst { gql } = require('apollo-server-express');
to theindex.js
file in the blog example project.Then add these two custom queries to the schema by adding the following code to the
index.js
file in the blog example project.Run the blog example project and open the graphql playground http://localhost:3000/admin/graphiql
run the following query in the playground
Expected result:
Actual result:
The
getWorld
query when run on its own returns the "world" string, however when it is called usingkeystone.executeGraphQL
in thegetHello
query, thegetWorld
query returns null and throws the following error,TypeError: Cannot read property 'setCacheHint' of undefined
This is due to
info.cacheControl
being undefined when a query is called fromkeystone.executeGraphQL