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

Session not working in nextjs 15 #884

Open
rutmus opened this issue Jan 8, 2025 · 3 comments · May be fixed by #885
Open

Session not working in nextjs 15 #884

rutmus opened this issue Jan 8, 2025 · 3 comments · May be fixed by #885

Comments

@rutmus
Copy link

rutmus commented Jan 8, 2025

I've been trying to use the session to access the jwt props but it seems to not work well due to incompatibilities with next 15

image

I saw you've already referenced this but I think that you will need to change the session to async or export sessionPromise in addition to make next 15 happy

// from Next.js 15, headers() returns a Promise

@allenzhou101
Copy link
Contributor

Taking a look!

@allenzhou101
Copy link
Contributor

Reproduced and we're working on a fix.

@allenzhou101 allenzhou101 linked a pull request Jan 8, 2025 that will close this issue
2 tasks
@asafshen
Copy link
Member

asafshen commented Jan 9, 2025

hey @rutmus

as a workaround to this issue - you can use getSession to extract the descope session (I created tempSession to demonstrate that )

import { getSession } from "@descope/nextjs-sdk/server";
import { headers } from "next/headers";

// tempo
async function tempSession() {
  const currHeaders = await headers();
  const req = {
    headers: {
      'x-descope-session': currHeaders.get('x-descope-session'),
    }
  }
  return getSession(req as any);
}

export default async function Page() {
  // get current request
  const currSession = await tempSession();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants