简体   繁体   English

无法在类型“Query”graphql/template-strings 上查询字段“allDevArticles”以获取 dev.to 文章

[英]Cannot query field “allDevArticles” on type “Query” graphql/template-strings for fetching dev.to articles

I am using the gatsby-source-dev gatsby plugin to get all my dev.to articles on my gatsby page.我正在使用 gatsby-source-dev gatsby 插件在我的 gatsby 页面上获取我的所有 dev.to 文章。 https://github.com/geocine/gatsby-source-dev https://github.com/geocine/gatsby-source-dev

It was working fine but recently it started giving me this error.它工作正常,但最近它开始给我这个错误。

"cannot query field "allDevArticles" on type "Query" graphql/template-strings" “无法在类型“查询”graphql/模板字符串上查询字段“allDevArticles””

and not able to fetch my latest articles on the site.并且无法在网站上获取我的最新文章。

My gatsby-config.js looks like this我的 gatsby-config.js 看起来像这样


module.exports = {

  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `profile`,
        path: `./data`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-transformer-json`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-source-dev`,
      options: {
        username:'vish448'
      }
    },
  ],
}

My graphql query on the page looks like this我在页面上的 graphql 查询看起来像这样

export const query = graphql`
query ArticlePageQuery {
    allDevArticles {
    nodes {
      article {
        title
        url
        published_at(formatString: "DD MMM YYYY")
      }
    }
  }
}`

I have updated my configuration in gatsby-config.js for gatsby-source-dev plugin and it works fine.我已经在 gatsby-config.js 中为 gatsby-source-dev 插件更新了配置,它工作正常。 So basically those string quotes are causing an issue.所以基本上这些字符串引号引起了问题。 I have changed those quotes to string literals (``)我已将这些引号更改为字符串文字 (``)


module.exports = {
  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `profile`,
        path: `./data`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-transformer-json`,
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-source-dev`,
      options: {
        **username:`vish448`**
      }
    },
  ],
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在类型“用户”graphql 上查询字段“密码” - Cannot query field 'password' on type 'User' graphql 官方Graphql教程“无法在CreateUser类型上查询字段'id'” - “cannot query field 'id' on type CreateUser” with official Graphql tutorial Graphql 内容查询错误“无法查询字段” - Graphql contentful query with error 'cannot query field' 无法在类型“QueryRoot”上查询字段“XXX”。”(GraphQL 的 Lacinia Clojure 库) - Cannot query field `XXX' on type `QueryRoot'." (Lacinia Clojure library for GraphQL) GraphQL / Relay架构无法在“CreateLinkPayload”类型上查询字段“store” - GraphQL/Relay Schema Cannot query field “store” on type “CreateLinkPayload” Apollo GraphQL 教程:“GraphQLError: Cannot query field \”id\“ on type \”LaunchConnection\“。” - Apollo GraphQL tutorial: “GraphQLError: Cannot query field \”id\“ on type \”LaunchConnection\“.” Gatsby GraphQL 无法在 Strapi 的“文件”类型上查询字段“url” - Gatsby GraphQL cannot query field “url” on type “File” of Strapi GitHub GraphQl api v4 返回“无法查询类型查询的字段存储库” - GitHub GraphQl api v4 return "Cannot query field repository on type Query" 无法在 GraphQL 中查询字段(平台 API,Symfony) - Cannot query field in GraphQL (Platform API, Symfony) 获取内容时 graphql 查询中出现未知类型错误? - unknown type error in graphql query while fetching content?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM