TanStackT
TanStack10mo ago
1 reply
hurt-tomato

Cannot read properties of undefined (reading 'config')

Whenever I'm navigating in the project I'm getting the error from the title.

It seems to be caused by the
beforeLoad
from __root.tsx

The code:

  beforeLoad: async () => {
    const headers = getHeaders() // THIS LINE GETS HIGHLIGHTED AS AN ERROR
    const data = await auth.api.getSession({
      headers
    })

    return {
      user: data?.user,
      session: data?.session,
    };
  },


I'm using better-auth for authentication purposes.
Was this page helpful?