fix: ensure unique GraphQL schema caching per API key#16411
fix: ensure unique GraphQL schema caching per API key#16411charlesBochet merged 5 commits intomainfrom
Conversation
- Enhanced schema caching mechanism by including the authorization header in the cache key, improving cache hit accuracy. - Updated related patch file and yarn.lock to reflect changes in dependencies and checksums. This change optimizes the handling of GraphQL requests by ensuring that cached schemas are specific to user context, reducing unnecessary recomputation.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
No issues found across 2 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:62417 This environment will automatically shut down when the PR is closed or after 5 hours. |
charlesBochet
left a comment
There was a problem hiding this comment.
@abdulrahmancodes thanks!
Question / feedbacks:
- Could you document how you were able to generate the patch, I was struggling with it last time I try, if you found a reliable way to generate it, that's great, we should document it somewhere :)
- I'm surprised about all the changes, I would expect that we just need to add the apiKeyId instead of workspaceUserId in the cacheKey.
- storing authHeader as cacheKey is a bad idea, security wise
|
@charlesBochet Thanks for the feedback. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
...rc/modules/messaging/message-import-manager/services/messaging-message-list-fetch.service.ts
Fixed
Show fixed
Hide fixed
443567a to
29484db
Compare
|
Hey @charlesBochet! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
Description
This PR fixes an issue where the GraphQL schema was being incorrectly cached and shared across different API keys within the same workspace. This resulted in the
createdByfield (Actor) from the first API key's request being erroneously attributed to subsequent requests made by different API keys.Changes
@graphql-yoga/nestjspatch to include the request'sAuthorizationheader in the schema cache key generation logic.Closes #15093