Deploying a Gatsby site on Netlify using the Gatsby-Source-Instagram plugin. Failing on Build time. Issue with Netlify fetching data from Instagram? Cannot reproduce locally

Hi all,

I am deploying a Gatsby site on Netlify using the Gatsby-Source-Instagram plugin. Recently for me and other users, Netlify seems to have trouble to fetch data from instagram and fails therefore on build time. Locally we can’t seem to reproduce the issue even with the netlify-cli’s ‘netlify build’ command. In some cases the build goes through, but more often than not it fails.
As it works locally I assume this is not a problem with Instagram, but with Netlify? Anyone else having issues?

2 Likes

I encountered the same issue using the gatsby-source-instagram plugin. However, the build failing seems random, after a couple ‘Clear cache and deploy’ I managed to get a successful build using the exact same code.

1 Like

Same here. I managed to randomly get a successful build, but then half an hour later build would fail again. It fails more often than it works unfortunately.

1 Like

Having the same problem.

8:23:22 PM: error There was an error in your GraphQL query:

8:23:22 PM: Cannot query field "allInstaNode" on type "Query".

8:23:22 PM: If you don't expect "allInstaNode" to exist on the type "Query" it is most likely a typo.

8:23:22 PM: However, if you expect "allInstaNode" to exist there are a couple of solutions to common problems:

8:23:22 PM: - 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

8:23:22 PM: - 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

8:23:22 PM: - You want to optionally use your field "allInstaNode" 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 a least one entry with that field ("dummy content")

8:23:22 PM: 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 "Query":

8:23:22 PM: https://www.gatsbyjs.org/docs/schema-customization/#creating-type-definitions

8:23:22 PM: failed extract queries from components - 1.019s

Haven’t been able to get a successful build, even after clearing cache and redeploying.

1 Like

I’m having the same issue too. It started happening 5/28 for me but was working fine before that. Sometimes it will go away after a redeploy, sometimes it takes multiple redeploys or a gap in time before it works. I’m happy to troubleshoot more if somebody needs more information to solve this.

1 Like

I think this might be an IG issue based on some digging I found:

https://github.com/oorestisime/gatsby-source-instagram/issues/24#issuecomment-637309561

I’m not sure why this is happening only from Netlify and not locally, but as I alluded to in the GH comment, it might be an IP address space or something.

1 Like

Having the same issue, works locally but fails on Netlify build.

+1, also having the same issue

Seems like the issue is related to changes that Instagram made. I got my site to build following the steps in this comment on the Github issue:

  1. Upgrade gatsby-source-instagram to 0.8.0-beta.0
  2. Get the Instagram user id using this tool
  3. Replace the username for gatsby-source-instagram in your gatsby-config.js with the user id from step 2
1 Like

Thanks for posting this solution, @VadimBrodsky. We certainly appreciate it (and I suspect @banx does as well). :+1:

1 Like

Just to clarify @VadimBrodsky’s solution step #3

I changed this:

    {
      resolve: `gatsby-source-instagram`,
      options: {
        username: `myusername`,
      },
    }

to this:

    {
      resolve: `gatsby-source-instagram`,
      options: {
        username: `12345678`,
      },
    }

And that’s the new configuration that got it working for me. Literally just replace the username value with the id from his step #2.

1 Like

this worked for me too. But im getting 50 pictures and there are all unordered and not in the order they were posted in :confused: did you have this ssue?

This appears to be an issue with the gatsby-source-instagram plugin and, as such, you should consult the authors of this plugin. :+1:

Yep, i got the answer for this issue here- https://github.com/oorestisime/gatsby-source-instagram/issues/24#issuecomment-645340838

Hi all, I followed the steps @VadimBrodsky mentioned (in fact, my plugin was already configured this way) but I’m still getting the same error. This happens every so often to multiple sites of mine and I have no idea what the cause/solution is. Any other ideas? I’ve uninstalled and reinstalled, reconfigured my query to be called from somewhere else… I’m out of ideas.

Hey @mugb,

Seen your Helpdesk ticket and responded there. But, in short, I don’t believe there have been any changes on our side but I will confirm this with the team.

You may want to reach out to the plugin author, in case there have been changes there (or, worse, at Instagram)!

This has been a very frustrating, recurring issue since last year, and appears limited to Netlify and other cloud deploys while being impossible to replicate locally. I’m not sure if there’s something that needs to be done with the plugin or if the infrastructure triggers an Instagram login screen, or both, but there appears to be no solution for end users other than to try to find another plugin or stop using Instagram.

Hi, I originally opened this issue a couple months ago and it seems like since last week it’s been happening for a few people again. For me actually, after this issue wasn’t really resolved last year, I instead went with fetching the posts manually and stopped using the gatsby-source-instagram plugin as it’s too unreliable.

Because many people seemed to have this issue, I got around and wrote a blog post about the solution that fixed it for me.
Here is the:

Hope this fixes it for you as well! Cheers

2 Likes

thank you so much for sharing, @banx!

1 Like

Worked like a charm! Thank you @banx