Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSR cache example is now completly different #28988

Closed
macrozone opened this issue Sep 10, 2021 · 3 comments
Closed

SSR cache example is now completly different #28988

macrozone opened this issue Sep 10, 2021 · 3 comments
Labels
bug Issue was opened via the bug report template. examples Issue/PR related to examples

Comments

@macrozone
Copy link

What example does this report relate to?

examples/ssr-caching

What version of Next.js are you using?

11.x

What version of Node.js are you using?

12.x

What browser are you using?

chrome

What operating system are you using?

mac os

How are you deploying your application?

next start

Describe the Bug

The ssr example used to use cacheable-response.

the goal was to cache expensive server side rendering, so subsequent requests could be served from cache.

Many users might require this as switching to static generated pages is not always feasible, as is using a cdn cache.

The new example does not mention anything about ssr caching, it just explains some browser caching. I think that could also be used by CDN, but the example does not mention anything like that.

This is probably because vercel wants to push their own hosting, so alternatives get obfuscated.

This is also apparent when you look at this short discussion that got closed by vercel without providing any explanation: #26540

Expected Behavior

i expect nextjs contributors to not change examples to something completly different and to explain decisions, instead of just closing issues.

I expect to have a ssr-caching example like it previously was that does not require additional knowledge and services.

I expect that when architectural changes like this should be needed, that we get a description to go from the previous approach to the new one

To Reproduce

just check out the example, it won't work like it previously did.

@macrozone macrozone added bug Issue was opened via the bug report template. examples Issue/PR related to examples labels Sep 10, 2021
@jukbot
Copy link

jukbot commented Sep 11, 2021

Agreed with you, the new one got a different approach, I think cacheableResponse is flexible enough to do some pre-calculated response from LRU cache. The document is lacking information when using CDN or the usage of cache strategy.

The new approach should be separated into the new one since the behavior is different from the previous one. The previous one aims to cache globally to all visitors which reduces the cost of computed response, by the way, cacheableResponse can cache responses one by one using the cache key.

In my opinion, the goal of #26540 is the fix from #12019 and striped out additional dependency when working with SSR caching.

@balazsorban44
Copy link
Member

The example has been changed because with a custom server, you opt out of many features of Next.js and so it is actively not recommended to use. We will probably not add custom server examples going forward.

From the docs:

Before deciding to use a custom server, please keep in mind that it should only be used when the integrated router of Next.js can't meet your app requirements. A custom server will remove important performance optimizations, like serverless functions and Automatic Static Optimization.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. examples Issue/PR related to examples
Projects
None yet
Development

No branches or pull requests

3 participants