Shield rules with cache: "strict" don't work on types.
See original GitHub issueBug report
- [x ] I have checked other issues to make sure this is not a duplicate.
Describe the bug
When using shield rule on type with cache: "strict"
authorization result is always “Not Authorized”
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
(Delete the filler code and replace it with your own)
- This is my GraphQL Schema.
type Query {
clinics: [Clinic]!
}
type Clinic {
id: ID!
name: String!
}
- This is the invoked query
clinics {
id
name
}
- I use these permissions
const permissions = shield({
Query: {
clinics: allow,
},
Clinic: rule({ cache: 'strict' })(async (parent, args, ctx, info) => {
return true;
}),,
})
- All results are not authorized.
Expected behavior
Rule should be called once per “Type” and validate access to it.
Actual behaviour
Rule always return “Not authorized”
Additional
If this is wrong usage of rules then it should be somehow thrown as an error
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
Caching - Akamai TechDocs
Akamai servers don't cache objects when the no-store or no-cache directives are present in the. Cache-Control header, or when the private directive is...
Read more >Cache Coherence - an overview | ScienceDirect Topics
Cache coherence is a concern in a multicore environment because of distributed L1 and L2 caches. Since each core has its own cache,...
Read more >Configuring Caching and Compression - Barracuda Campus
Caching works well for responses containing static pages which remain unmodified over multiple requests. When response content is likely to ...
Read more >Easy Cloudflare Tutorial (including Page Cache rules)
Improve your website's performance with this detailed Cloudflare tutorial. It includes optimized Page Rules and the correct Page Cache rule ...
Read more >How to Cache Dynamic Content in WordPress - WP Rocket
In this article you'll learn what's dynamic content, how dynamic content caching works, its various benefits, and the multiple ways you can ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can’t seem to recreate this issue anymore either - I have set all my rules back from no_cache to strict which were strict previously. As we test the app I will let you know if anything pops up, but I can’t recreate it inside our app, or in the sandbox you provided.
I have run into this issue, but specifically only when a parent is null and cache === “strict”. The rule does not even run at all. When debug=true, the following error is output:
stacktrace: