@graphql-yoga/plugin-response-cache
Changelog for @graphql-yoga/plugin-response-cache: every release with its changes and the pull requests behind them.
4.0.0
Major Changes
-
#4574
79b0e8bThanks @egoodwinx! - ### Breaking Changes- Node: minimum supported version is now Node 22. Node 18 and 20 are no longer supported. Future releases will only support Node >=22.
- GraphQL: minimum supported version is now GraphQL 16. GraphQL 14 and 15 are no longer supported.
- Request body parsing: Yoga now limits request bodies to 25,000,000 bytes by default.
Enforcing this limit streams the body through a byte counter, making POST body parsing
asynchronous even for an in-memory body. As a result,
yoga.fetch()can return a Promise where it previously returned a synchronous Response, even when all resolvers and plugins are synchronous.
Migration
- If you’re on Node 18/20, upgrade to Node 22 or later before upgrading this package.
- If you’re on graphql 14/15, upgrade to graphql 16 or 17 first.
- Await
yoga.fetch()and response body parsing instead of relying on synchronous results. SetmaxRequestBodySize: falseincreateYogato disable the body-size limit and preserve synchronous parsing for in-memory bodies, but only if you enforce an appropriate request-body limit elsewhere.
Patch Changes
-
#4575
862447aThanks @egoodwinx! - Use@graphql-hive/loggerand add correlated, per-request logging (closes #4048)Every request now gets its own logger, available as
context.log(andserverContext.login plugin hooks), tagged with arequestId. Everything logged while handling a request can be correlated by that id.The request id is taken from the host integration if it already assigned one (e.g. Fastify’s
request.id), otherwise from the incomingx-request-idheader, otherwise generated. It is also sent back in thex-request-idresponse header. Configure it with the newrequestIdoption:createYoga({ requestId: { // don't trust the incoming header, recommended when clients can reach the server directly trustHeader: false, headerName: 'x-correlation-id', generateRequestId: () => myId() } })Pass
requestId: falseto disable it.At the
infolevel, a single “Request processed” line is logged per request with the method, path, operation name and type, response status, error count and duration. At thedebuglevel, more details about request processing are logged.Masked errors are now logged with the request’s logger, so they can be traced back to the request that caused them. Custom
maskErrorfunctions receive the request’s context as an optional fourth argument.The
@envelop/newrelic,@envelop/auth0,@envelop/resource-limitations,@envelop/statsd,@envelop/graphql-jit,@envelop/response-cacheand@envelop/response-cache-cloudflare-kvplugins accept a newlogoption for their own messages, instead of always writing to the console.@envelop/response-cache’sshouldCacheResultnow also receives the GraphQLcontext.Breaking Changes
- The
@graphql-yoga/loggerpackage has been removed.graphql-yogare-exportsLogger,MemoryLogWriterandLogLevelfrom@graphql-hive/loggerinstead. createLoggerand theYogaLoggertype are no longer exported. Usenew Logger(options)instead.- The
loggingoption now takesboolean | Logger | LogLevel, whereLoggeris the one from@graphql-hive/logger. yoga.loggerhas been renamed toyoga.log.- The
loggeroption ofuseGraphiQLanduseHealthCheckhas been removed. They now log through the request’s logger. @graphql-yoga/nestjsnow logs through Nest’sLoggerby default instead of not logging at all. Passlogging: falseto keep the previous behaviour.logging: trueon Fastify no longer logs through Fastify’s logger, pass it explicitly instead (see below).@envelop/apollo-federation,@envelop/auth0,@envelop/graphql-jit,@envelop/newrelic,@envelop/resource-limitations,@envelop/response-cache,@envelop/response-cache-cloudflare-kvand@envelop/statsdnow have a peer dependency on@graphql-hive/loggerthat you must install.@envelop/apollo-federation’sloggeroption now expects aLoggerfrom@graphql-hive/loggerand defaults tonew Logger()instead ofconsole.
Migration
Create loggers with
Logger:- import { createLogger } from 'graphql-yoga'; + import { Logger } from 'graphql-yoga'; createYoga({ - logging: createLogger('debug'), + logging: new Logger({ level: 'debug' }), });Use
loginstead ofloggeron the Yoga instance:const plugin = { onYogaInit({ yoga }) { - yoga.logger.info('ready'); + yoga.log.info('ready'); }, };Prefer the request-scoped logger inside resolvers and plugin hooks so the logs carry the request id:
const resolvers = { Query: { hello: (_, __, context) => { context.log.debug('resolving hello') return 'world' } } }If you use any of the
@envelop/*plugins listed above, install the logger:npm i @graphql-hive/loggerIf you depended on
@graphql-yoga/loggerdirectly, switch to@graphql-hive/logger:- import { Logger } from '@graphql-yoga/logger'; + import { Logger } from '@graphql-hive/logger';To keep logging through Fastify’s logger in
@graphql-yoga/nestjs:import { Logger } from 'graphql-yoga' import { PinoLogWriter } from '@graphql-hive/logger/writers/pino' // in your yoga driver options logging: new Logger({ writers: [new PinoLogWriter(app.log)] }) - The
-
Updated dependencies [
862447a,79b0e8b,be89d05,5334079,79b0e8b]:- graphql-yoga@6.0.0
- @envelop/response-cache@10.0.0
- @envelop/core@6.0.0
3.26.6
Patch Changes
3.26.5
Patch Changes
- Updated dependencies []:
- graphql-yoga@5.24.5
3.26.4
Patch Changes
3.26.3
Patch Changes
3.26.2
Patch Changes
- Updated dependencies
[
c08efde]:- graphql-yoga@5.24.2
3.26.1
Patch Changes
- Updated dependencies
[
c6a9aa4]:- graphql-yoga@5.24.1
3.26.0
Patch Changes
-
#4577
7bff35cThanks @egoodwinx! - Add homepage and bugs.url to package.json files -
Updated dependencies [
7bff35c,3763aca]:- @envelop/response-cache@9.3.1
- @envelop/core@5.6.1
- graphql-yoga@5.24.0
3.25.0
Patch Changes
3.24.0
Minor Changes
-
#4545
94ebe5bThanks @egoodwinx! - Update to support graphql-js 17Bump package versions, fix expected typing, and update compatability with subscribe.
Patch Changes
- Updated dependencies
[
94ebe5b]:- @envelop/response-cache@9.2.0
- @envelop/core@5.6.0
- graphql-yoga@5.22.0
3.23.3
Patch Changes
- Updated dependencies
[
04014d2]:- graphql-yoga@5.21.3
3.23.2
Patch Changes
- Updated dependencies
[
39b55ba]:- graphql-yoga@5.21.2
3.23.1
Patch Changes
-
#4492
fbd8436Thanks @copilot-swe-agent! - Include theLast-Modifiedheader in early304 Not Modifiedresponses returned by the response-cache plugin’sonRequestshort-circuit path.Previously, this path returned only
ETag. Now it returns bothETagandLast-Modifiedfrom cached response metadata so conditional revalidation responses are consistent with the original cached200response headers.This improves interoperability with HTTP intermediaries and edge caches that rely on both validators (
If-None-MatchandIf-Modified-Since) during revalidation, helping avoid unstable cache states when only one validator is present in a304response. -
Updated dependencies [
4b43efd]:- graphql-yoga@5.21.1
3.23.0
Patch Changes
- Updated dependencies
[
e263f7e]:- graphql-yoga@5.21.0
3.22.0
Patch Changes
- Updated dependencies
[
93f1dc0]:- graphql-yoga@5.20.0
3.21.0
Patch Changes
- Updated dependencies
[
7e0aaf6]:- graphql-yoga@5.19.0
3.20.1
Patch Changes
- #4346
f98149aThanks @ardatan! - dependencies updates:- Updated dependency
@envelop/core@workspace:^↗︎ (from^5.3.0, independencies) - Updated dependency
@envelop/response-cache@workspace:^↗︎ (from^9.0.0, independencies)
- Updated dependency
- Updated dependencies
[
9a221c3,f98149a]:- graphql-yoga@5.18.1
3.20.0
Patch Changes
- Updated dependencies
[
3eabd17]:- graphql-yoga@5.18.0
3.19.1
Patch Changes
-
#4302
c27f550Thanks @beaumontjonathan! - Bump @whatwg-node/promise-helpers to fix missing export unfakePromise -
Updated dependencies [
c27f550]:- graphql-yoga@5.17.1
3.19.0
Patch Changes
3.18.2
Patch Changes
- #4278
b8d2f70Thanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@^9.0.0↗︎ (from^8.0.0, independencies)
- Updated dependency
- Updated dependencies
[
ba38629]:- graphql-yoga@5.16.2
3.18.1
Patch Changes
3.18.0
Patch Changes
- #4184
3841884Thanks @EmrysMyrddin! - Fix types for thecacheoption. Envelop cache implementations (redis and CloudFlare KV) are now usable without TS errors. - Updated dependencies
[
a4e1c5f,0a7a635]:- graphql-yoga@5.16.0
3.17.2
Patch Changes
- Updated dependencies
[
e7b8906]:- graphql-yoga@5.15.2
3.17.1
Patch Changes
- Updated dependencies
[
ecd605b]:- graphql-yoga@5.15.1
3.17.0
Patch Changes
3.16.0
Patch Changes
-
#4087
6e04a7fThanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@^8.0.0↗︎ (from^7.1.3, independencies)
- Updated dependency
-
#4088
98c82a5Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/core@^5.3.0↗︎ (from^5.2.3, independencies)
- Updated dependency
-
Updated dependencies [
5f75a42,98c82a5,98c82a5]:- graphql-yoga@5.14.0
3.15.6
Patch Changes
- Updated dependencies
[
8b41a52]:- graphql-yoga@5.13.5
3.15.5
Patch Changes
- Updated dependencies
[
000c33d]:- graphql-yoga@5.13.4
3.15.4
Patch Changes
3.15.3
Patch Changes
3.15.2
Patch Changes
- #3865
dee7995Thanks @ardatan! - dependencies updates:- Updated dependency
@envelop/core@^5.2.3↗︎ (from^5.2.1, independencies) - Updated dependency
@envelop/response-cache@^7.1.3↗︎ (from^7.1.1, independencies)
- Updated dependency
- Updated dependencies
[
dee7995]:- graphql-yoga@5.13.1
3.15.1
Patch Changes
- #3860
9599d45Thanks @renovate! - dependencies updates:- Added dependency
@whatwg-node/promise-helpers@^1.2.4↗︎ (todependencies)
- Added dependency
3.15.0
Patch Changes
- #3793
63b78d5Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/core@^5.2.1↗︎ (from^5.0.2, independencies) - Updated dependency
@envelop/response-cache@^7.1.1↗︎ (from^7.0.0, independencies)
- Updated dependency
- Updated dependencies
[
63b78d5,63b78d5,6ed67e8]:- graphql-yoga@5.13.0
3.14.2
Patch Changes
- Updated dependencies
[
a6b3de9]:- graphql-yoga@5.12.2
3.14.1
Patch Changes
- Updated dependencies
[
fbf328c]:- graphql-yoga@5.12.1
3.14.0
Patch Changes
- #3780
ea63828Thanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@^7.0.0↗︎ (from^6.1.2, independencies)
- Updated dependency
- Updated dependencies
[
96498ee,5150146,5150146]:- graphql-yoga@5.12.0
3.13.1
Patch Changes
-
#3759
bba7a83Thanks @enisdenjo! - Provide cache key per oparation in a batched requestInstead of per request, which would give out the same cache key for every operation in a batched request.
3.13.0
Patch Changes
3.12.11
Patch Changes
- Updated dependencies
[
1c055f5]:- graphql-yoga@5.10.11
3.12.10
Patch Changes
- Updated dependencies []:
- graphql-yoga@5.10.10
3.12.9
Patch Changes
3.12.8
Patch Changes
- Updated dependencies
[
ed344ea]:- graphql-yoga@5.10.8
3.12.7
Patch Changes
3.12.6
Patch Changes
- Updated dependencies
[
121ccba]:- graphql-yoga@5.10.6
3.12.5
Patch Changes
3.12.4
Patch Changes
-
#3520
944ecd5Thanks @ardatan! - dependencies updates:- Added dependency
@envelop/core@^5.0.2↗︎ (todependencies)
- Added dependency
-
#3520
944ecd5Thanks @ardatan! - Pass `context` tosessionandbuildResponseCacheKeySo now
sessioncan get the context to use the JWT token extracted by JWT Plugin for instance;useResponseCache({ session: (req, ctx) => ctx.jwt.token }) -
Updated dependencies [
944ecd5]:- graphql-yoga@5.10.4
3.12.3
Patch Changes
3.12.2
Patch Changes
3.12.1
Patch Changes
- Updated dependencies
[
20cd9b6]:- graphql-yoga@5.10.1
3.12.0
Patch Changes
- Updated dependencies
[
f81501c]:- graphql-yoga@5.10.0
3.11.0
Patch Changes
3.10.0
Patch Changes
3.9.0
Patch Changes
3.8.3
Patch Changes
- Updated dependencies
[
0866c1b]:- graphql-yoga@5.6.3
3.8.2
Patch Changes
3.8.1
Patch Changes
- Updated dependencies
[
4252e3d]:- graphql-yoga@5.6.1
3.8.0
Patch Changes
- Updated dependencies
[
9f3f945]:- graphql-yoga@5.6.0
3.7.0
Patch Changes
- Updated dependencies
[
0208024]:- graphql-yoga@5.5.0
3.6.0
Patch Changes
- #3300
fdd902cThanks @EmrysMyrddin! - dependencies updates:- Updated dependency
graphql-yoga@workspace:^↗︎ (from^5.3.1, inpeerDependencies)
- Updated dependency
- Updated dependencies
[
4cd43b9,fdd902c,d5dfe99,7335a82,f9aa1cd]:- graphql-yoga@5.4.0
3.5.1
Patch Changes
3.5.0
Patch Changes
3.4.0
Patch Changes
-
#3181
35387c04Thanks @gilgardosh! - Type fix to match@envelop/response-cache-redis -
Updated dependencies [
71db7548,71db7548]:- graphql-yoga@5.2.0
3.3.0
Minor Changes
- #3164
353c0fedThanks @n1ru4l! - AddservedFromResponseCachesymbol property to responses served from the response cache in order to allow other plugins to determine, whether a response was served from the cache and apply custom logic based on that.
3.2.1
Patch Changes
- Updated dependencies
[
3ef877a7]:- graphql-yoga@5.1.1
3.2.0
Patch Changes
- Updated dependencies
[
b1f0e3a2]:- graphql-yoga@5.1.0
3.1.3
Patch Changes
3.1.2
Patch Changes
- Updated dependencies
[
77d107fe]:- graphql-yoga@5.0.2
3.1.1
Patch Changes
- Updated dependencies
[
3fea19f2]:- graphql-yoga@5.0.1
3.1.0
Minor Changes
- #3092
befaf3ceThanks @EmrysMyrddin! - ExposehashSHA256sha256 implementation to ease cache key factory customisation.
Patch Changes
-
#3092
befaf3ceThanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/response-cache@^6.1.0↗︎ (from^6.0.0, independencies)
- Updated dependency
-
#3092
befaf3ceThanks @EmrysMyrddin! - Fix missing export ofCachetype andcacheControlDirectiveexports
3.0.0
Major Changes
-
#3070
5b615478Thanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@^6.0.0↗︎ (from^5.3.2, independencies)
- Updated dependency
-
#3063
01430e03Thanks @EmrysMyrddin! - Breaking Change: Drop support of Node.js 16
Patch Changes
2.2.0
Minor Changes
-
#2993
0c6625adThanks @EmrysMyrddin! - support @cacheControl(scope: CacheControlScope), allowing to enforce cache depending on session -
#2993
0c6625adThanks @EmrysMyrddin! - Add support for @stream and @defer directives
Patch Changes
-
#2993
0c6625adThanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/response-cache@^5.3.0↗︎ (from^5.1.0, independencies)
- Updated dependency
-
#3006
2a122360Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/response-cache@^5.3.2↗︎ (from^5.3.0, independencies)
- Updated dependency
-
#3000
caf75884Thanks @EmrysMyrddin! - Fix incompatible type of in-memory cache factory withcacheoption -
Updated dependencies [
bf602edf]:- graphql-yoga@4.0.5
2.1.1
Patch Changes
- Updated dependencies
[
5f182006]:- graphql-yoga@4.0.4
2.1.0
Minor Changes
96882491Thanks @EmrysMyrddin! - Add @cacheControl directive to configure cache in a schema first approach
Patch Changes
96882491Thanks @EmrysMyrddin! - dependencies updates:- Updated dependency
@envelop/response-cache@^5.1.0↗︎ (from^5.0.0, independencies)
- Updated dependency
- Updated dependencies
[
5efb8250]:- graphql-yoga@4.0.3
2.0.2
Patch Changes
- Updated dependencies
[
ce6d2465]:- graphql-yoga@4.0.2
2.0.1
Patch Changes
2.0.0
Major Changes
Patch Changes
- Updated dependencies
[
4228c1d5,34ecb4bb,ec318fe6,cc370691,b309ca0d,dd699c4b,4228c1d5,0522c740]:- graphql-yoga@4.0.0
1.9.1
Patch Changes
1.9.0
Patch Changes
- Updated dependencies
[
aff69200]:- graphql-yoga@3.9.0
1.8.1
Patch Changes
1.8.0
Patch Changes
1.7.3
Patch Changes
-
Updated dependencies [
46e75917]:- graphql-yoga@3.7.3
1.7.2
Patch Changes
- Updated dependencies
[
7ad50529]:- graphql-yoga@3.7.2
1.7.1
Patch Changes
1.7.0
Minor Changes
-
#2252
4e824b3dThanks @ardatan! - SupportETagandIf-None-Matchheaders for HTTP Caching to improve the performance on the client side, also reduce the load on the server.
Patch Changes
-
#2452
64f769ecThanks @ardatan! - dependencies updates:- Updated dependency
@envelop/response-cache@^4.0.6↗︎ (from4.0.5, independencies)
- Updated dependency
-
#2459
9e743db5Thanks @ardatan! - dependencies updates:- Updated dependency
@envelop/response-cache@^4.0.6↗︎ (from4.0.5, independencies)
- Updated dependency
-
Updated dependencies [
23d1b26c,9e743db5,23d1b26c]:- graphql-yoga@3.7.0
1.6.1
Patch Changes
- Updated dependencies
[
3c8c8434]:- graphql-yoga@3.6.1
1.6.0
Patch Changes
- #2391
87d39f03Thanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@4.0.5↗︎ (from4.0.4, independencies)
- Updated dependency
- Updated dependencies
[
790330be,6bc1410f,ddb2607d,6bc1410f,1caac99b,790330be,7587d5c5,cc0d3899,a747d249,2933fc89,543e490b]:- graphql-yoga@3.6.0
1.5.1
Patch Changes
- Updated dependencies
[
3a8446df]:- graphql-yoga@3.5.1
1.5.0
Patch Changes
- Updated dependencies
[
03597a5a]:- graphql-yoga@3.5.0
1.4.1
Patch Changes
1.4.0
Patch Changes
- Updated dependencies
[
76c1ecb9,8cd8b5a5,6e8bddba,6ee252db,8f139e15,9beef914,c46d75e8,f9ab8a70]:- graphql-yoga@3.4.0
1.3.1
Patch Changes
- Updated dependencies
[
d4dab446]:- graphql-yoga@3.3.1
1.3.0
Patch Changes
1.2.1
Patch Changes
- Updated dependencies
[
5528d312]:- graphql-yoga@3.2.1
1.2.0
Patch Changes
1.1.2
Patch Changes
1.1.1
Patch Changes
- Updated dependencies
[
534780c9]:- graphql-yoga@3.1.1
1.1.0
Patch Changes
1.0.3
Patch Changes
- #2156
491ef5daThanks @renovate! - dependencies updates:- Updated dependency
@envelop/response-cache@4.0.4↗︎ (from4.0.3, independencies)
- Updated dependency
- Updated dependencies
[
491ef5da]:- graphql-yoga@3.0.3
1.0.2
Patch Changes
1.0.1
Patch Changes
- Updated dependencies
[
d63fe841]:- graphql-yoga@3.0.1
1.0.0
Major Changes
-
#1359
5629a5cbThanks @ardatan! - New Response Cache Plugin!!!On top of
@envelop/response-cache, this new plugin allows you to skip execution phase even before all the GraphQL execution phases immediately after the GraphQL request parameters is parsed by Yoga.Also it doesn’t need to have
documentStringstored in somewhere in order to get it back during the execution to generate the cache key.All the features of the same except for the following:
-
sessionfactory function takesGraphQLParamsandRequestobjects instead of GraphQL context as arguments.type SessionIdFactory = (params: GraphQLParams, request: Request) => Maybe<string>
-
enabledfunction takesGraphQLParamsandRequestobjects instead of GraphQL context as arguments.type EnabledFn = (params: GraphQLParams, request: Request) => boolean
-
Patch Changes
- Updated dependencies
[
2e0c4824,8773a27f,720898db,9f991a27,6e250209,cebca219,eeaced00,74e1f830,e7a47b56,5f5b1160,1d7f810a,209b1620,098e139f,73e56068,02d2aecd,74e1f830,c4b3a9c8,b079c93b,71554172,b19a9104,1d5cde96,44878a5b,1d508495]:- graphql-yoga@3.0.0
1.0.0-next.12
Patch Changes
- Updated dependencies
[
73e56068]:- graphql-yoga@3.0.0-next.12
1.0.0-next.11
Patch Changes
1.0.0-next.10
Patch Changes
1.0.0-next.9
Patch Changes
1.0.0-next.8
Patch Changes
- Updated dependencies
[
6e250209]:- graphql-yoga@3.0.0-next.8
1.0.0-next.7
Patch Changes
1.0.0-next.6
Patch Changes
- Updated dependencies
[
dc45a7b5]:- graphql-yoga@3.0.0-next.6
1.0.0-next.5
Patch Changes
- Updated dependencies
[
71554172]:- graphql-yoga@3.0.0-next.5
1.0.0-next.4
Patch Changes
1.0.0-next.3
Patch Changes
- Updated dependencies
[
64e06d74]:- graphql-yoga@3.0.0-next.3
1.0.0-next.2
Patch Changes
- Updated dependencies
[
8c674c36]:- graphql-yoga@3.0.0-next.2
1.0.0-next.1
Patch Changes
- Updated dependencies
[
44878a5b]:- graphql-yoga@3.0.0-next.1
1.0.0-next.0
Major Changes
-
#1359
5629a5cbThanks @ardatan! - New Response Cache Plugin!!!On top of
@envelop/response-cache, this new plugin allows you to skip execution phase even before all the GraphQL execution phases immediately after the GraphQL request parameters is parsed by Yoga.Also it doesn’t need to have
documentStringstored in somewhere in order to get it back during the execution to generate the cache key.All the features of the same except for the following:
-
sessionfactory function takesGraphQLParamsandRequestobjects instead of GraphQL context as arguments.type SessionIdFactory = (params: GraphQLParams, request: Request) => Maybe<string>
-
enabledfunction takesGraphQLParamsandRequestobjects instead of GraphQL context as arguments.type EnabledFn = (params: GraphQLParams, request: Request) => boolean
-