RFC: discuss value of Next.js middleware
See original GitHub issueNext.js supports middleware, which this library could recommend as a way to integrate with next-firebase-auth
. I’d like to gather input on whether middleware provides value that the current API (withAuthUser
and withAuthUserTokenSSR
) does not.
My initial assessment is that middleware usage could be a good option for apps where auth info is needed on many or all pages and the server-side auth/redirect settings don’t change between pages. In this scenario, middleware could provide an AuthUser on the request object in getServerSideProps
or redirect as needed.
However:
- Middleware can’t currently set return data or set React context; thus, unlike the existing API for SSR pages, AuthUser won’t be set on the client side until the Firebase JS SDK initializes.
- Middleware reduces flexibility on whether to use auth info on individual pages.
Feedback and input appreciated!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top Results From Across the Web
RFC: Middleware · Discussion #29750 · vercel/next.js - GitHub
We propose to introduce a native capability in Next.js to define Middleware, allowing for complete flexibility of the upstream request as well as...
Read more >middleware-upgrade-guide - Next.js
Currently, Middleware estimates whether you are serving an asset of a Page based on the Next.js routes manifest (internal configuration). This value is...
Read more >Next.js 12.2 Overview: Middleware, Layouts, and more
Next. js 12.2 introduces stable Middleware and On-Demand ISR, experimental Edge SSR and API Routes, and more.0:00 Intro1:50 Agenda2:30 ...
Read more >Passing variables from middleware to page in Next.js 12 new ...
"enables you to use code over configuration. This gives you full flexibility in Next.js because you can run code before a request is...
Read more >What's New in Next.js 13 - AppSignal Blog
If you use Server Components in Next.js, you can reduce the amount of JavaScript sent to the client, enabling faster initial page loads....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem seems to be the fs module used by the Firebase Admin SDK
yes, that sounds great, I would gladly prepare a pull request with the changes, I’ll try to have one ready by the end of the week