- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问题:
我的 next-auth 在本地工作,但是当我将它部署到 Netlify 时,我在访问任何内容时都会收到此 CLIENT_FETCH_ERROR(RouteGuard 组件调用 useSession Hook 并推送到/auth/signin,如果未在非公共(public)路径上进行身份验证 &&)。
GET https://website.com/api/auth/session 400--> Error: This action with HTTP GET is not supported by NextAuth.js
[next-auth][error][CLIENT_FETCH_ERROR] Unexpected token 'E', "Error:Thi"... is not valid JSON
POST https://website.com/api/auth/_log 400
它在本地调用 http://localhost:4200/api/auth/session 并使用 {} 返回 304。
调用 useSession 钩子(Hook)的地方:
_app > session 提供者 session={session} > RouteGuard
根据文档预期的 API 返回:
https://next-auth.js.org/getting-started/client#getsession
When called, getSession() will send a request to /api/auth/session andreturns a promise with a session object, or null if no session exists.
https://next-auth.js.org/getting-started/rest-api#get-apiauthsession
Returns client-safe session object - or an empty object if there is no session.The contents of the session object that is returned are configurable with the session callback.
session 回调:
async session({ session, token, user }) {
session.accessToken = token.accessToken
session.user._id = token.sub
session.user.name = token.name
session.user.email = token.email
if (token.login_provider) session.user.login_provider = token.login_provider
return session
}
我已经在本地和 Netlify 上检查过的内容:
"next": "11.1.0",
"next-auth": "^4.6.1",
我还应该检查什么?
Google 搜索、阅读文档、重新阅读文档并尝试了一天都无济于事......
请帮忙/o\
更新:
next-auth.csrf-token
next-auth.callback-url
更新 2:
最佳答案
使用 next@12.3.1 和 next-auth@4.14.0 的确切版本修复了它。
在这里找到解决方案:https://answers.netlify.com/t/nexauth-returning-action-not-found/77779/5
关于authentication - next-auth GET/api/auth/session 400 CLIENT_FETCH_ERROR 意外 token 'E'(Netlify 部署),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74144025/
我在自己的服务器上托管我的网站,并使用 Netlify CMS。但是,我仍然希望使用 Netlify 的托管 Identity 和 Git 网关服务,而不是运行我自己的服务。 最佳答案 是的,这是可能
我正在使用 Netlify主持github repo并试图找到一种方法来在域上托管其他文件。 (如果您不知道 Netlify 是什么,请查看它。据我所知,它是 AWS 代码部署的快速脏版和免费版本。(
我正在使用 Netlify主持github repo并试图找到一种方法来在域上托管其他文件。 (如果您不知道 Netlify 是什么,请查看它。据我所知,它是 AWS 代码部署的快速脏版和免费版本。(
Netlify 子域基于存储库上的分支工作。如果我有一个域名 xyz.com 和 repo Repo-A,master 分支将部署到 xyz.com 和 dashboard 分支将部署到 dashbo
我想根据环境代理到不同的 api - 我尝试了以下主题的一些变体,但没有任何运气。如果可能的话,正确的方法是什么? [build.environment] API_URI="https://dev
根据 Netlify docs for custom headers我可以创建一个路径来使用自定义 header # use these headers for the /index.html fil
根据 Netlify docs for custom headers我可以创建一个路径来使用自定义 header # use these headers for the /index.html fil
我正在尝试将我的 Hugo 网站上传到 Netlify,但在构建过程中出现 命令失败,退出代码 255: hugo 错误。由于这是我自己手工编码的东西,我确信我在这个过程中遗漏了一些重要的文件,这会导
正如标题所说,部署到 Netlify 失败,从日志来看可能是我的 parcel.js设置。日志中的错误是: 12:19:29 AM: Error running command: Build scri
我正在尝试使用 Netlify CMS 和 Hugo ssg 来头脑清醒。 我使用: netlify-cms@1.0 hugo@0.29 我有一个简单的 netlify-cms config.yml,
我在我的 gatsby 项目中设置了 netlify 函数,具有代理等功能。如果我通过 netlify 部署,一切都会按预期进行。如果我使用 gatsby cloud 进行另一次部署它实际上从 net
免责声明:我会使用 a.) Netlify 上的某种支持系统,b.) Netlify 实时聊天 session 或 c.) 通过他们的支持社区来提问,但是a.) 他们不允许你,b.) 他们没有,c.)
Netlify 社区经常提出的另一个问题。 “Netlify 能否在不强制使用 SSL (TLS) 的情况下将流量从 http 重定向到 https?” Once you have a certifi
我有一个像这样的 _redirects 文件: https://example.netlify.com/* https://example.com/:splat 301! 在根文件夹中。 如何使用 g
是否有人幸运地使用 OAUTH 从 Netlify CMS 向 GB 进行身份验证,但没有使用 Netlify API?如果有的话,你用的是什么?我想使用我的域进行身份验证,但我不确定应该使用哪个 A
问题让 .env 在 Netlify 上工作。 我的仓库在这里: nuxt-axios-sheets 我在浏览器控制台中得到 key=undefined:加载资源失败:服务器响应状态为400 () 这
我认为标题是不言自明的。可以在这里找到存储库: https://github.com/netlify/netlify-cms/ https://github.com/netlify/git-gatew
我正在尝试使用 netlify 来托管静态站点。我正在使用 wget -mk http://hostname/ 构建网站所以我得到了大量的静态文件,并重写了链接。 我想将他们推到 netlify 并让
我正在尝试部署我的 nextjs 应用程序 netlify,但它一直向我抛出失败错误,没有部署这是我的 github 存储库 https://github.com/farishelmipermana/
我正在尝试部署我的 nextjs 应用程序 netlify,但它一直向我抛出失败错误,没有部署这是我的 github 存储库 https://github.com/farishelmipermana/
我是一名优秀的程序员,十分优秀!