Route 404 when visiting protected routes (when deployed only)

if I visit
/
I get no problem, but when I try to visit /dashboard that use a
beforeLoad
, I get 404, thi happens to me on vercel.

(I'm using vite+react)

// dashboard.tsx
export const Route = createFileRoute("/search/dashboard")({
  component: Index,

  beforeLoad: async ({ location }) => {
    const isAuth = await isAuthenticated();

    if (!isAuth?.tokens) {
      throw redirect({
        to: "/sign-in",
        search: {
          // Use the current location to power a redirect after login
          // (Do not use `router.state.resolvedLocation` as it can
          // potentially lag behind the actual current location)
          redirect: location.href,
        },
      });
    }
  },
});
Was this page helpful?