错误#11321插件“ gatsby-source-strapi”运行Sourcenodes时丢下错误

发布于 2025-02-08 10:29:06 字数 915 浏览 3 评论 0原文

我正在生产服务器上运行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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不顾 2025-02-15 10:29:07

您必须将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".

苯莒 2025-02-15 10:29:07

我已经尝试了您的建议(令牌),但没有起作用。
我的环境:
Win11

"gatsby": "^5.7.0"
"gatsby-source-strapi": "^3.0.6"
strapi project:  "@strapi/strapi": "4.8.2",

I've tried what you suggested (the token) but didn't work.
My environment:
Win11

"gatsby": "^5.7.0"
"gatsby-source-strapi": "^3.0.6"
strapi project:  "@strapi/strapi": "4.8.2",
请帮我爱他 2025-02-15 10:29:07

我正在与Gatsby -Strapi一起做一个项目。当我尝试将工作盖茨比连接到strapi时,我遇到了一个错误: console.log of Or

此刻,我参加了盖茨比项目:
“盖茨比”:“^5.3.3”
“ Gatsby-Source-Strapi”:“^3.0.4”。

在Strapi项目中:
“@strapi/strapi”:“ 4.5.5”,

我使用了盖茨比的文档,但是除此之外,我还必须添加此信息:

  1. 作为Mac用户,我必须在config.json中使用此行进行插件配置:
    解决: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:

  1. As a MAC user, I have to use this line in config.json for plugin configuration:
    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.
仙女 2025-02-15 10:29:07
{
  resolve: "gatsby-source-strapi",
  options: {
    apiURL: "http://localhost:1337",
    accessToken: "", //add your access token in Settings > API Tokens >  Create new API token >  give permission to all "Find", "FindOne" and give Token Type "Full Access"
    collectionTypes: [
      {
        singularName: "post", // Ex :- if your api like  "http://localhost:1337/api/posts"  
      },
    ],
  },
},
{
  resolve: "gatsby-source-strapi",
  options: {
    apiURL: "http://localhost:1337",
    accessToken: "", //add your access token in Settings > API Tokens >  Create new API token >  give permission to all "Find", "FindOne" and give Token Type "Full Access"
    collectionTypes: [
      {
        singularName: "post", // Ex :- if your api like  "http://localhost:1337/api/posts"  
      },
    ],
  },
},
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文