diff --git a/dist/esm/server/lib/incremental-cache/index.js b/dist/esm/server/lib/incremental-cache/index.js index 93519fc1e45361f153edd1f4496ca4a006745e8f..8d603be638c297db9593ae9fa92ec5359d38f823 100644 --- a/dist/esm/server/lib/incremental-cache/index.js +++ b/dist/esm/server/lib/incremental-cache/index.js @@ -348,10 +348,11 @@ export class IncrementalCache { }); } if (this.dev && !ctx.fetchCache) return; + const max_fetch_size = Number(process.env.MAX_FETCH_SIZE) || 5 // gets value set in next.config // fetchCache has upper limit of 2MB per-entry currently - if (ctx.fetchCache && JSON.stringify(data).length > 2 * 1024 * 1024) { + if (ctx.fetchCache && JSON.stringify(data).length > max_fetch_size * 1024 * 1024) { if (this.dev) { - throw new Error(`fetch for over 2MB of data can not be cached`); + throw new Error(`fetch for over ${max_fetch_size}MB of data can not be cached`); } return; } diff --git a/dist/server/lib/incremental-cache/index.js b/dist/server/lib/incremental-cache/index.js index 83e061e5a072d253c2db7ea5e796307070cb1f81..5f9a462e3e12965a49ab6419b19ef2fa0aae7fe6 100644 --- a/dist/server/lib/incremental-cache/index.js +++ b/dist/server/lib/incremental-cache/index.js @@ -375,10 +375,11 @@ class IncrementalCache { }); } if (this.dev && !ctx.fetchCache) return; + const max_fetch_size = Number(process.env.MAX_FETCH_SIZE) || 5 //gets value set in next.config // fetchCache has upper limit of 2MB per-entry currently - if (ctx.fetchCache && JSON.stringify(data).length > 2 * 1024 * 1024) { + if (ctx.fetchCache && JSON.stringify(data).length > max_fetch_size * 1024 * 1024) { if (this.dev) { - throw new Error(`fetch for over 2MB of data can not be cached`); + throw new Error(`fetch for over ${max_fetch_size}MB of data can not be cached`); } return; }