Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
micro fix of the cache limit check (vercel#60249)
### Fixing a bug I'm sorry, I have no idea how I managed to delete this, as I just copied the code. However, I had to figure out why the tests passed. When I test the running application locally, it works as expected. So, when a route is first used in a running production application in a test, `ctx.fetchCache` is `undefined`. Therefore, the error rule does not trigger on the first request, and the cache is successfully written. This may result in artifacts in FetchCache in Vercel and possibly in other parts of the code. ```ts if ( ctx.fetchCache && // <- Undefined on first request // we don't show this error/warning when a custom cache handler is being used // as it might not have this limit !this.hasCustomCacheHandler && JSON.stringify(data).length > 2 * 1024 * 1024 ) { if (this.dev) { throw new Error(`fetch for over 2MB of data can not be cached`) } return } ``` I'm 95% sure that this is a bug and it shouldn't work like this. I'll look into this later and if there is an error, I'll put it into a task and try to figure it out later. Unfortunately, the [test](https://github.com/vordgi/next.js/blob/7e028fb6d8598cfcca8de514e4608374f931c973/test/e2e/app-dir/app-static/app-static.test.ts#L3080) from [previous PR](vercel#59976) is not working yet, although it is correct from my point of view. I think it should be kept and the problem above should be fixed. Co-authored-by: JJ Kasper <[email protected]>
- Loading branch information