-
Notifications
You must be signed in to change notification settings - Fork 396
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
Bail out of static rendering for pages and routes in app dir #1541
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1541 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 63 62 -1
Lines 6558 6293 -265
Branches 487 500 +13
==========================================
- Hits 6558 6293 -265
☔ View full report in Codecov by Sentry. |
|
You must have Developer access to commit code to Auth0 on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes. Learn more: https://vercel.com/docs/concepts/teams/roles-and-permissions#enterprise-team-account-roles |
This works great for my projects - tested on several. Thanks for sorting this, hopefully this can be made official soon? |
src/session/get-access-token.ts
Outdated
sessionCache: SessionCache | ||
): GetAccessToken { | ||
return async (reqOrOpts?, res?, accessTokenRequest?): Promise<GetAccessTokenResult> => { | ||
const options = (res ? accessTokenRequest : reqOrOpts) as AccessTokenRequest | undefined; | ||
const req = (res ? reqOrOpts : undefined) as IncomingMessage | NextApiRequest | undefined; | ||
// TODO: clean up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be removed or is there work to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yep, will remove that comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor comment around the todo
📋 Changes
Ensure
getConfig
doesn't run when the Next.js app is being statically rendered (because static rendering happens at build time and users don't necessarily want to supply the config at build time)The 2 large commits are for making sure the config can be lazily evaluated at request time (
config
->getConfig(req)
):The 3rd small commit is using this to bail out of static rendering before getting the config.
bec7d6c - Bail out of static rendering for pages and routes in app dir
You can bail out of static rendering by using the
cookies()
helper for Server Components and inspecting the request'surl
for API routes📎 References
fixes #1356
vercel/next.js#49006
🎯 Testing