KindeK
Kinde14mo ago
6 replies
Gamer Guy

Next.js Build doesn't call getUser() from kinde

Hey all,

Nextjs calls all of the requests in a file when running npm run build. This causes my requests to fire, but not kinde's getKindeServerSession() or getUser() functions.

I'm trying to test my production build. I currently have Kinde set up to return a kinde object, which then sends a request to my backend to get the user object based on the kinde id.

The issue I'm running into is the await getUser() returns
null
when I run npm run build on my nextJS project. This causes an error with the user on the backend (because
null
user does not exist), resulting in a 400 on the backend, which gets sent to the FE.

Is this intentional? I don't know why this happens. I can prevent the build from failing with some if statements, so it's not a blocker. I'm curious if I'm misunderstanding something with nextjs entirely or if this is kinde specific.
image.png
Was this page helpful?