Next.js nextjs console.log在函数返回函数中不起作用

Next.js nextjs console.log在函数返回函数中不起作用,next.js,Next.js,我在玩nextjs 我很难调试像这样的函数 这: 在页面中使用 ProfilePage.getInitialProps = async () => { const auth = authInitialProps(true); if (!typeof auth === "function") { const user = await getUserProfile(); return { user }; } return { user: null }; };

我在玩nextjs 我很难调试像这样的函数 这:

在页面中使用

ProfilePage.getInitialProps = async () => {
  const auth = authInitialProps(true);
  if (!typeof auth === "function") {
    const user = await getUserProfile();
    return { user };
  }
  return { user: null };
};
我从未在chrome控制台中看到我的内部日志 在我的控制台终端。 有什么问题吗?

试试这个,它可能会起作用:

ProfilePage.getInitialProps = async () => {
  const auth = await authInitialProps(true); // await added
  if (!typeof auth === "function") {
    const user = await getUserProfile();
    return { user };
  }
  return { user: null };
};
我认为它应该是异步的,不能通过它

ProfilePage.getInitialProps = async () => {
  const auth = await authInitialProps(true); // await added
  if (!typeof auth === "function") {
    const user = await getUserProfile();
    return { user };
  }
  return { user: null };
};