Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashtag Graph API function doesn't work #183

Open
n1s opened this issue Jan 11, 2021 · 5 comments
Open

Hashtag Graph API function doesn't work #183

n1s opened this issue Jan 11, 2021 · 5 comments

Comments

@n1s
Copy link

n1s commented Jan 11, 2021

I don't see the new hashtag function developed by @joelmturner in #164 working for me.

data seems simply not to be fetched.

ERROR #85923  GRAPHQL

There was an error in your GraphQL query:

Cannot query field "hashtags" on type "InstaNode".

If you don't expect "hashtags" to exist on the type "InstaNode" it is most likely a typo.
However, if you expect "hashtags" to exist there are a couple of solutions to common problems:

- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "hashtags" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add at least one entry with
that field ("dummy content")

It is recommended to explicitly type your GraphQL schema if you want to use optional fields. This way you don't have to add the mentioned "dummy content". Visit our docs to learn how you can define the schema
 for "InstaNode":
https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

Query same as in the example provided

  query IndexQuery {
    allInstaNode(limit: 30) {
      edges {
        node {
          id
          username
          likes
          caption
          comments
          hashtags
          localFile {
            childImageSharp {
              fluid(quality: 100, maxWidth: 600, maxHeight: 600) {
                ...GatsbyImageSharpFluid_withWebp_tracedSVG
              }
            }
          }
        }
      }
    }
  }

Plugin config

    {
      resolve: `gatsby-source-instagram`,
      options: {
        username: ###########,
        instagram_id: ############,
        access_token: process.env.FB_ACCESS_KEY,
        hashtags: { // hashtags: true // neither works
          enabled: true,
          commentDepth: 0
        }
      }
    },

User content is pulled correctly without specifying hashtags.

Am I doing anything wrong here?

@joelmturner
Copy link
Contributor

I've seen this a few times recently as well. It will sometimes start pulling correctly for me after restarting the dev server, and I can't tell what the pattern is that makes it work. I haven't had time to look into why it's failing yet, but I might have some availability in 2 weeks to take a look.

@n1s
Copy link
Author

n1s commented Jan 19, 2021

thanks @joelmturner . I might find a free moment and try to debug it. The problem is that my experience is limited and debugging with gatsby node looks a a bit steep. Are you aware of any decent debugging guide that might be a help?

@oorestisime
Copy link
Owner

Any reliable way to reproduce can help here :)

@joelmturner
Copy link
Contributor

I haven't been able to reliably reproduce this issue but it does seem related to #24. Something that worked for me this weekend was the following:

  1. upgrade to the latest gatsby and gatsby-source-filesystem
  2. delete yarn.lock and node_modules
  3. yarn install

Since doing that, I haven't seen the errors again. Hopefully, this helps until we can find a more consistent way.

I also explored updating the query in the gatsby-source-instagram to use v9.0 of the graph API which produced the same result as the current v7.0. I was hoping v9.0 would get through some of the auth better, but it doesn't appear to.

@m5kr1pka
Copy link

The issue keeps coming up: npm run clean helped me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants