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

Problems with using the Instagram Graph API #153

Closed
sklinkusch opened this issue Jun 2, 2020 · 3 comments
Closed

Problems with using the Instagram Graph API #153

sklinkusch opened this issue Jun 2, 2020 · 3 comments

Comments

@sklinkusch
Copy link

I am building for my employer an Instagram fetch component on his website. The latest eight images of the company's Instagram profile are fetched and included on the website. As the whole website is a Gatsby project, I wanted to use the gatsby-source-instagram plugin.
Since a while, I get the warning: Could not get instagram posts using the Graph API. Error status Error: Request failed with status code 400. Then, it falls back to public scraping. So far, so good. When the website is built on Netlify, this fails. This is my error message:
Could not get instagram posts using the Graph API. Error status Error: Request failed with status code 400 Falling back to public scraping... with (name of the profile) Could not fetch instagram posts. Error status TypeError: Cannot read property '0' of undefined The gatsby-source-instagram plugin has generated no Gatsby nodes. Do you need it? and later:
error There was an error in your GraphQL query: Cannot query field "allInstaNode" on type "Query".
If I am right, fetching the posts fails for the Graph API request as well as for public scraping. Thus, allInstaNodes is not there and it fails on a server. Locally, only public scraping works.
This is my request:
import { useStaticQuery, graphql } from "gatsby" export const useInstaNode = () => { const { allInstaNode } = useStaticQuery( graphql
query InstaPosts {
allInstaNode(filter: { mediaType: { eq: "GraphImage" } }, limit: 8) {
edges {
node {
id
mediaType
timestamp
caption
localFile {
childImageSharp {
fluid(maxWidth: 290) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
) return allInstaNode }
In my gatsby-config.js, I provided username, access_token, and instagram_id. gatsby-source-instagram is v0.7.0 and gatsby is v2.19.10. Can anybody help me that my request is working also on a server?

@oorestisime
Copy link
Owner

The instagram api returning 400 probably is due to invalid token i suppose?

About public scraping failing it is probably related to #24
Hopefully i ll have a fix tonight.

@sklinkusch
Copy link
Author

I can check the token later. It was generated last year and as far as I know it never worked. We had always this issue with falling back to public scraping. Now, combined with the other error, this Instagram component stopped to work for new deploys.

@oorestisime
Copy link
Owner

If it never worked the token must be invalid. Please have a look at the steps to maybe generate a new one https://github.com/oorestisime/gatsby-source-instagram#instagram-graph-api-token

I am closing this issue as it is a duplicate of #24 . make sure to check that one for updates regarding public scraping.

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

2 participants