Welcome to the Kinde community

Updated 9 months ago

NextJs getOrganization from client component null propertie

Hello so take that code
Plain Text
"use client";

import { useKindeBrowserClient } from "@kinde-oss/kinde-auth-nextjs";
import { FC } from "react";

type ServicesPageProps = {};

const ServicesPage: FC<ServicesPageProps> = ({}) => {
  const { getOrganization } = useKindeBrowserClient();
  console.log(getOrganization().orgCode);

  return <div>ServicesPage</div>;
};

export default ServicesPage;


This produce this error :
Plain Text
TypeError: Cannot read properties of null (reading 'orgCode')


getOrganization() returns a string not an object but the issue is that when working in vscode getOrganization(). brings intelisense with orgcode
Attachment
image.png
I
A
4 comments
Let me check with the team on this
Looks like a mismatch between the types ({ orgCode: string | null; }) and what is actually returned string | null . The team is working on a PR to address this for you.
Add a reply
Sign up and join the conversation on Discord