2
votes

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
As you sure the username is configured as you describe? If the user name is wrong you will get the error message you described. Generally speaking, the error means "no articles found". See github.com/gatsbyjs/gatsby/issues/3344ehrencrona
Thanks @ehrencrona, you're right.vsoni

1 Answers

0
votes

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`**
      }
    },
  ],
}