【问题标题】:Auth0 Next.js error withPageAuthRequired You should not access 'res' after getServerSideProps resolvesAuth0 Next.js 错误 withPageAuthRequired 您不应该在 getServerSideProps 解决后访问“res”
【发布时间】:2022-01-09 01:48:09
【问题描述】:

我似乎得到了错误:

You should not access 'res' after getServerSideProps resolves.

使用以下代码:

export const getServerSideProps = withPageAuthRequired({
  async getServerSideProps(ctx){
    // access the user session
    const session = getSession(ctx.req,ctx.res);
    return {props:{
      customProp:'bar'
    }};
   }
});

此代码直接来自https://auth0.github.io/nextjs-auth0/modules/helpers_with_page_auth_required.html#withpageauthrequiredoptions

我不知道在实现 auth0 时是否有办法摆脱这个警告我在 Next.js 12.0.4 & auth0 ^1.6.1

消除此错误的最佳方法是什么?

【问题讨论】:

标签: next.js auth0


【解决方案1】:

不是错误,是警告

这里的警告是decribed,不是简单的solution

附:我的项目中有相同的东西,等待更新修复。这个bug出现在下一个^12.0.2版本

【讨论】:

  • 对不起,我的措辞错误意味着要输入警告,好吧只是想确保我没有错误地实现它或引入安全漏洞
猜你喜欢
  • 2021-06-23
  • 2023-04-03
  • 2021-04-23
  • 2020-12-13
  • 2021-09-26
  • 2021-07-01
  • 2021-11-02
  • 2023-02-12
  • 2023-02-10
相关资源
最近更新 更多