-
Notifications
You must be signed in to change notification settings - Fork 7
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
fix(nextjs-sdk): add support for NextJS 15 #885
base: main
Are you sure you want to change the base?
Conversation
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.
Cool
Let's see how to solve this issue without breaking BC
// from Next.js 15, headers() returns a Promise | ||
// It can still be used synchronously to facilitate migration | ||
const reqHeaders = headers() as never as HeaderTypes; | ||
export const session = async (): Promise<AuthenticationInfo | undefined> => { |
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.
Think break BC
Also for someone that is not using next 15
Let's think about how to achieve that breaking
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.
Seems to maintain backwards compatibility and access the session synchronously server-side, we would need to switch off of headers, cookies, or any other API from NextJS that is now asynchronous. So doing the same thing where we set the session into whatever storage mechanism (like how it's headers right now) in middleware and accessing via session function.
Options are:
- File-Based Storage (https://www.npmjs.com/package/@types/better-sqlite3)
- Different cookie library that's synchronous (https://www.npmjs.com/package/cookie)
Thoughts on this? At some point we'll probably have to bite the bullet and make the session call async, but maybe once NextJS fully moves off?
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
View your CI Pipeline Execution ↗ for commit 017a3d7.
☁️ Nx Cloud last updated this comment at |
Related Issues
Fixes #884
Description
Migrates the SDK to NextJS 15
Must