Auth0 Nextjs 14 ssr On vercel just does not work

Ready to post? :mag: First, try searching for your answer.
I have Server side page in next js 14. Everything works fine locally but not in vercel. This is the code I am using and not sure where I am going wrong. Any help will be greatly appreciated

Feels like auth0 does not work on nextjs ssr

/profile.service.ts

import 'server-only';
import { Claims, getSession } from '@auth0/nextjs-auth0';

export const getUserProfileData = async (): Promise<Claims> => {
  const session = await getSession();

  if (!session) {
    throw new Error(`Requires authentication`);
  }

  const { user } = session;

  return user;
};

Agent.tsx


import { getUserProfileData } from '@/app/services/profile.service';
import { withPageAuthRequired } from '@auth0/nextjs-auth0';

const Agent = withPageAuthRequired(
  async () => {
    const user = await getUserProfileData();

    return user ? (
      <div>
        <img src={user.picture} alt={user.name} />
        <h2>{user.name}</h2>
        <p>{user.email}</p>
      </div>
    ) : (
      <div>No user logged in</div>
    );
  },
  { returnTo: '/api/auth/login' }
);

export default Agent;