IsConnected not a function in next.js app

to solve the “isConnected is not a function” error, change the function getServerSideProps to:

export async function getServerSideProps(context) {

  let isConnected;
  try {
    const client = await clientPromise
    isConnected = true;
  } catch(e) {
    console.log(e);
    isConnected = false;
  }

  return {
    props: { isConnected },
  }
}

Thanks,
Rafael,

4 Likes