Cannot query field "allDevArticles" on type "Query" graphql/template-strings for fetching dev.to articles

Viewed 1723

I am using the gatsby-source-dev gatsby plugin to get all my dev.to articles on my gatsby page. 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"

and not able to fetch my latest articles on the site.

My gatsby-config.js looks like this


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

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

I have updated my configuration in gatsby-config.js for gatsby-source-dev plugin and it works fine. 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`**
      }
    },
  ],
}

Related