错误#11321插件“ gatsby-source-strapi”运行Sourcenodes时丢下错误
我正在生产服务器上运行strapi,这是我的代码gatsby-config
:
{
resolve: `gatsby-source-strapi`,
options: {
apiURL: `http://strapi.myserver.com/api`,
queryLimit: 1000, // Default to 100
collectionTypes: [`Career`],
token: 'mytoken'
},
}
当我转到http://strapi.myserver.com/api/时,我的API正常工作。职业
但是graphiql
看不到它们,当我运行gatsby开发
时,它会引发以下错误:
ERROR #11321 PLUGIN
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Request failed with status code 404
ERROR #11321 PLUGIN
"@relate-app/gatsby-source-strapi" threw an error while running the createSchemaCustomization lifecycle:
request to http://strapi.myserver.com/api/graphql failed, reason: getaddrinfo ENOTFOUND strapi.myserver.com
此答案无济于事:
也是我的我的我的我也是我的。用户权限所有这些都已检查,我的收藏集已发布。
I am running my strapi on production server, and this is my code in gatsby-config
:
{
resolve: `gatsby-source-strapi`,
options: {
apiURL: `http://strapi.myserver.com/api`,
queryLimit: 1000, // Default to 100
collectionTypes: [`Career`],
token: 'mytoken'
},
}
My apis are working correctly when I go to http://strapi.myserver.com/api/careers
however graphiQL
doesn't see them, also when I run gatsby develop
it throws these errors:
ERROR #11321 PLUGIN
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Request failed with status code 404
ERROR #11321 PLUGIN
"@relate-app/gatsby-source-strapi" threw an error while running the createSchemaCustomization lifecycle:
request to http://strapi.myserver.com/api/graphql failed, reason: getaddrinfo ENOTFOUND strapi.myserver.com
This answer didn't help: (Gatsby-Strapi) Error: Request failed with status code 404
Also my user permissions all of them are checked, my collections are published.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须将API令牌类型更改为“完全访问”。转到设置>全球设置>然后,API令牌然后单击您的API令牌中的编辑图标,然后将令牌类型更改为“ Full Access”。
You have to change your API token type to "Full access". Go to Settings > Global Settings > API Tokens then click on edit icon in at your API Token and then change token type to "Full access".
我已经尝试了您的建议(令牌),但没有起作用。
我的环境:
Win11
I've tried what you suggested (the token) but didn't work.
My environment:
Win11
我正在与Gatsby -Strapi一起做一个项目。当我尝试将工作盖茨比连接到strapi时,我遇到了一个错误: console.log of Or
此刻,我参加了盖茨比项目:
“盖茨比”:“^5.3.3”
“ Gatsby-Source-Strapi”:“^3.0.4”。
在Strapi项目中:
“@strapi/strapi”:“ 4.5.5”,
我使用了盖茨比的文档,但是除此之外,我还必须添加此信息:
解决:
gatsby-source-strapi
,选项: {
apiurl:
http://127.0.0.1:1337
,collectionTypes:[<代码>作业],
},,
在这些行之后,我仍然有403个错误,但是在浏览器中,我可以得到一个JSON对象。为了解决此错误,我像某人建议的那样创建了API令牌,但是可以完全访问。否则,错误不会发生。我试图创建一个只有阅读和阅读的令牌,但这并没有解决我的问题。
I'm doing a project with Gatsby - Strapi. And when I tried to connect working Gatsby to Strapi, I had this error:console.log of error
At this moment, I had in gatsby project:
"gatsby": "^5.3.3"
"gatsby-source-strapi": "^3.0.4".
And in strapi project:
"@strapi/strapi": "4.5.5",
I used documentation from gatsby, but in addition to them, I have to add this:
resolve:
gatsby-source-strapi
,options: {
apiURL:
http://127.0.0.1:1337
,collectionTypes: [
jobs
],},
After those lines, I still had a 403 error, but in the browser, I could get a JSON object. To resolve this error, I created API Token, as someone suggested, but with full access. Otherwise, the error doesn't go. I had tried to create a token with read and read one only, but it didn't solve the problem for me.