You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you go to "Show type definition" this looks like this:
/** * Function for building the response cache key based on the input parameters */exporttypeBuildResponseCacheKeyFunction=(params: {/** Raw document string as sent from the client. */documentString: string;/** Variable values as sent form the client. */variableValues: ExecutionArgs['variableValues'];/** The name of the GraphQL operation that should be executed from within the document. */operationName?: Maybe<string>;/** optional sessionId for make unique cache keys based on the session. */sessionId: Maybe<string>;/** GraphQL Context */context: ExecutionArgs['contextValue'];})=>Promise<string>;
I.e context is supposed to be yielded to the function. However, this is always undefined. This is due to graphql-yoga not passing this context:
Yes, the type is currently not really accurate, sorry about that. A PR is open and will fix it. It will also give access to the HTTP request instead of the context (the context is not available in Yoga since the key has to be built before the context initialization).
Describe the bug
I am following the docs at https://the-guild.dev/graphql/yoga-server/docs/features/response-caching and trying to pass
buildResponseCacheKey
which is one of the configurable parameter options.If you go to "Show type definition" this looks like this:
I.e
context
is supposed to be yielded to the function. However, this is always undefined. This is due tographql-yoga
not passing this context:Your Example Website or App
https://codesandbox.io/p/sandbox/blissful-bouman-7jwxxn?file=%2Fsrc%2Fmain.ts%3A55%2C30
Steps to Reproduce the Bug or Issue
Unfortuntely something with "etag" is not working with GraphiQL which is a separate issue, so this sandbox doesn't work.
Expected behavior
I want context yielded as per type definitions
Screenshots or Videos
No response
Platform
@graphql-yoga/plugin-response-cache
version(s): [e.g. 2.1.1]Additional context
n/a
The text was updated successfully, but these errors were encountered: