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

[Question] NextJS 12 Support #273

Open
alegemaate opened this issue Jan 25, 2022 · 9 comments
Open

[Question] NextJS 12 Support #273

alegemaate opened this issue Jan 25, 2022 · 9 comments
Labels
question Question about usage of the library

Comments

@alegemaate
Copy link

Hello,

I have been using this package for multiple projects and it has been working great, thanks for providing such an awesome package!
I see in the README file that it mentions nextjs 9-11 support, and was curious if anyone has tried it using v12. I would like to get the development performance benefits that v12 is boasting but of course, wanted to ensure that this does work with v12 before doing so.

@ofhouse
Copy link
Member

ofhouse commented Jan 25, 2022

Hi, it should work with Next.js 12.
The CI generally runs the integration tests against the latest Next.js version, so it should be safe for you to upgrade.

The readme currently doesn't include v12 as supported version, since the major feature in v12 were edge functions (middleware), that we currently cannot support.
The support of this feature is limited upstream by AWS, since AWS provides no service that could handle middleware correctly at the edge.

But we may should update the readme to include v12 support (without middleware) 👍

@ofhouse ofhouse added the question Question about usage of the library label Jan 25, 2022
@alegemaate
Copy link
Author

Excellent!
I will give it a shot. I am most interested in the new SWR compiler 😄
I can of course, let you know if I do notice anything funky, thanks again!

@ofhouse
Copy link
Member

ofhouse commented Jan 26, 2022

Another missing feature from Next.js 12 is esm-support, that apparently does not work: #275

@alegemaate
Copy link
Author

@ofhouse Thanks for the info!

@khuezy
Copy link

khuezy commented Feb 7, 2022

@ofhouse would it be possible to support esm?

@ofhouse
Copy link
Member

ofhouse commented Feb 7, 2022

@ofhouse would it be possible to support esm?

@khuezy Yes, it's possible and on the roadmap. It is currently planned as part of #89.
Unfortunately I am a bit low on time at the moment so it might take a bit longer until this is shipped.

@khuezy
Copy link

khuezy commented Jun 3, 2022

@ofhouse sorry for the dumb question, but does the lambda support React Server Components (nextjs 12)

@ofhouse
Copy link
Member

ofhouse commented Jun 4, 2022

@khuezy No wrong questions here 😄
From my understanding React Server Components is simply using another response format (instead of text/html) but still relies on the standard HTTP protocol for communication.
What seems new here is that it is able to run the renderer in an asynchronous way which enables it to use HTTP streaming responses.

HTTP streaming itself is not a new technology and was established over 20 years ago (I think).
So instead of waiting until the full package has arrived, the browser can start painting the website when the first few bytes have arrived.
Lambda itself is currently not capable of HTTP streaming since it is invoked synchronously.
I think that AWS is actively working on bringing HTTP streaming to Lambda and the first sign of this was the introduction of functionUrls in April.

However I think HTTP streaming is not a big deal as Vercel markets it, since in practice it will probably reduce the time-to-first byte (TTFB) in between 10-20ms which is barely noticeable.
But even when AWS releases HTTP steaming for Lambda there is still the CloudFront CDN in front of it that will not support HTTP streaming in the foreseeable future.

Since a HTTP streaming response can always be converted into a synchronous HTTP response (via buffering) I don't see any issues why Lambda should not be able to render Server Components.

@khuezy
Copy link

khuezy commented Jun 4, 2022

Thanks for the response and info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about usage of the library
Projects
None yet
Development

No branches or pull requests

3 participants