Welcome to the Kinde community

Updated 19 hours ago

Migration to New Package Version

Hello team, we have a problem with the migration to the new package version, we are currently using "@kinde-oss/kinde-auth-nextjs": "^1.8.24",
and we are trying to migrate to "@kinde-oss/kinde-auth-nextjs": "^2.4.6" . We use Next.js 14v with page router. We did the migration based on https://docs.kinde.com/developer-tools/sdks/backend/nextjs-prev-sdk/. But we constantly get error 500 related to the session as in the picture below.

P
D
2 comments

Hey @Drago Vrban ,

I am going to get our NextJS team to also look at this.

If you are continuing using Pages Router, here are the key migration changes from v1 to v2:

•   The handleAuth import has changed:

import {handleAuth} from "@kinde-oss/kinde-auth-nextjs/server";


•   Functions returned from getKindeServerSession now return promises:

const {getUser} = getKindeServerSession();
const user = await getUser();


The session-related error you're experiencing could be due to these async changes in v2. Make sure all functions from getKindeServerSession are properly awaited.

Hey Andre, We do not use this function(getKindeServerSession()) anywhere within the project, maybe the issue is related to this issue that was reported, that's almost the same.
https://github.com/kinde-oss/kinde-auth-nextjs/issues/204

Add a reply
Sign up and join the conversation on Slack