Support » Plugin: WP Instagram Widget » Inconsistent 200 error with latest version

  • Resolved iangeek

    (@iangeek)


    I use the plugin across most sites I work on, and on most its working fine – but on a good handful the dreaded “instagram has returned a 200” has made a comeback in the past day or so. Tried all the usual cache and transient clears, and made sure I’m on 2.0.3, but still no joy.

    Any ideas?

    Cheers Scott

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Scott

    (@scottsweb)

    The fact that it is intermittent is interesting. It could be that Instagram are starting to throttle WordPress sites from visiting. We really need to debug the full error to understand what is happening.

    Modify this like:

    https://github.com/scottsweb/wp-instagram-widget/blob/master/wp-instagram-widget.php#L212

    Add a print_r( $remote ); above it and paste back the output here. It should give us more info.

    Hey Scott – OK, you ready for this one? I’ll skip ahead on the bits that don’t really add much to the story…

    
    Array
    (
        [headers] => Requests_Utility_CaseInsensitiveDictionary Object
            (
                [data:protected] => Array
                    (
                        [content-type] => text/html; charset=utf-8
                        [cache-control] => private, no-cache, no-store, must-revalidate
                        [pragma] => no-cache
                        [expires] => Sat, 01 Jan 2000 00:00:00 GMT
                        [vary] => Cookie, Accept-Language
                        [content-language] => en
                        [date] => Wed, 21 Mar 2018 23:55:57 GMT
                        [set-cookie] => Array
                            (
                                [0] => rur=PRN; Path=/
                                [1] => csrftoken=rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6; expires=Wed, 20-Mar-2019 23:55:57 GMT; Max-Age=31449600; Path=/; Secure
                                [2] => mid=WrLxDAAEAAFMegV-pjax-HlqsUhc; expires=Tue, 16-Mar-2038 23:55:57 GMT; Max-Age=630720000; Path=/
                            )
    
                        [content-length] => 21390
                    )
    
            )
    
        [body] => <!DOCTYPE html>
    <html lang="en" class="no-js not-logged-in ">
        <head><meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
            <title>
                      Page Not Found &bull; Instagram
                    </title>
    
            
            <meta name="robots" content="noimageindex, noarchive">
            <meta name="mobile-web-app-capable" content="yes">
            <meta name="theme-color" content="#000000">
            <meta id="viewport" name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover">
            
    
            <link rel="manifest" href="/data/manifest.json">
    
    

    Yadda yadda… whole load of HTML mark-up from Instagram error page leading up to…

    
        
    
    	<h2>Error</h2>
    
            <p>Please wait a few minutes before you try again.</p>
    
    

    Skip to the end until we’re back with the JSON…

    
            
        </body>
    </html>
        [response] => Array
            (
                [code] => 429
                [message] => Too Many Requests
            )
    
        [cookies] => Array
            (
                [0] => WP_Http_Cookie Object
                    (
                        [name] => rur
                        [value] => PRN
                        [expires] => 
                        [path] => /
                        [domain] => instagram.com
                    )
    
                [1] => WP_Http_Cookie Object
                    (
                        [name] => csrftoken
                        [value] => rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6
                        [expires] => 1553126157
                        [path] => /
                        [domain] => instagram.com
                    )
    
                [2] => WP_Http_Cookie Object
                    (
                        [name] => mid
                        [value] => WrLxDAAEAAFMegV-pjax-HlqsUhc
                        [expires] => 2152396557
                        [path] => /
                        [domain] => instagram.com
                    )
    
            )
    
        [filename] => 
        [http_response] => WP_HTTP_Requests_Response Object
            (
                [response:protected] => Requests_Response Object
                    (
                        [body] => <!DOCTYPE html>
    <html lang="en" class="no-js not-logged-in ">
        <head><meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
            <title>
                      Page Not Found &bull; Instagram
                    </title>
    
    

    Same again here so I'll skip ahead...

    
    	<h2>Error</h2>
    
            <p>Please wait a few minutes before you try again.</p>
    
    

    .. more skipped error page HTML / JS / CSS ..

    
           
        </body>
    </html>
                        [raw] => HTTP/1.1 429 -
    Content-Type: text/html; charset=utf-8
    Cache-Control: private, no-cache, no-store, must-revalidate
    Pragma: no-cache
    Expires: Sat, 01 Jan 2000 00:00:00 GMT
    Vary: Cookie, Accept-Language
    Content-Language: en
    Date: Wed, 21 Mar 2018 23:55:57 GMT
    Set-Cookie: rur=PRN; Path=/
    Set-Cookie: csrftoken=rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6; expires=Wed, 20-Mar-2019 23:55:57 GMT; Max-Age=31449600; Path=/; Secure
    Set-Cookie: mid=WrLxDAAEAAFMegV-pjax-HlqsUhc; expires=Tue, 16-Mar-2038 23:55:57 GMT; Max-Age=630720000; Path=/
    Connection: close
    Content-Length: 21390
    
    <!DOCTYPE html>
    <html lang="en" class="no-js not-logged-in ">
        <head><meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
            <title>
                      Page Not Found &bull; Instagram
                    </title>
    
    

    ... skipped HTML ...

     
                        [headers] => Requests_Response_Headers Object
                            (
                                [data:protected] => Array
                                    (
                                        [content-type] => Array
                                            (
                                                [0] => text/html; charset=utf-8
                                            )
    
                                        [cache-control] => Array
                                            (
                                                [0] => private, no-cache, no-store, must-revalidate
                                            )
    
                                        [pragma] => Array
                                            (
                                                [0] => no-cache
                                            )
    
                                        [expires] => Array
                                            (
                                                [0] => Sat, 01 Jan 2000 00:00:00 GMT
                                            )
    
                                        [vary] => Array
                                            (
                                                [0] => Cookie, Accept-Language
                                            )
    
                                        [content-language] => Array
                                            (
                                                [0] => en
                                            )
    
                                        [date] => Array
                                            (
                                                [0] => Wed, 21 Mar 2018 23:55:57 GMT
                                            )
    
                                        [set-cookie] => Array
                                            (
                                                [0] => rur=PRN; Path=/
                                                [1] => csrftoken=rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6; expires=Wed, 20-Mar-2019 23:55:57 GMT; Max-Age=31449600; Path=/; Secure
                                                [2] => mid=WrLxDAAEAAFMegV-pjax-HlqsUhc; expires=Tue, 16-Mar-2038 23:55:57 GMT; Max-Age=630720000; Path=/
                                            )
    
                                        [content-length] => Array
                                            (
                                                [0] => 21390
                                            )
    
                                    )
    
                            )
    
                        [status_code] => 429
                        [protocol_version] => 1.1
                        [success] => 
                        [redirects] => 1
                        [url] => https://instagram.com/tarasangermua/
                        [history] => Array
                            (
                                [0] => Requests_Response Object
                                    (
                                        [body] => 
                                        [raw] => HTTP/1.1 301 Moved Permanently
    Content-Type: text/html; charset=utf-8
    Location: https://instagram.com/tarasangermua/
    Cache-Control: private, no-cache, no-store, must-revalidate
    Pragma: no-cache
    Expires: Sat, 01 Jan 2000 00:00:00 GMT
    Vary: Accept-Language, Cookie
    Content-Language: en
    Date: Wed, 21 Mar 2018 23:55:56 GMT
    Set-Cookie: rur=PRN; Path=/
    Connection: close
    Content-Length: 0
    
                                        [headers] => Requests_Response_Headers Object
                                            (
                                                [data:protected] => Array
                                                    (
                                                        [content-type] => Array
                                                            (
                                                                [0] => text/html; charset=utf-8
                                                            )
    
                                                        [location] => Array
                                                            (
                                                                [0] => https://instagram.com/tarasangermua/
                                                            )
    
                                                        [cache-control] => Array
                                                            (
                                                                [0] => private, no-cache, no-store, must-revalidate
                                                            )
    
                                                        [pragma] => Array
                                                            (
                                                                [0] => no-cache
                                                            )
    
                                                        [expires] => Array
                                                            (
                                                                [0] => Sat, 01 Jan 2000 00:00:00 GMT
                                                            )
    
                                                        [vary] => Array
                                                            (
                                                                [0] => Accept-Language, Cookie
                                                            )
    
                                                        [content-language] => Array
                                                            (
                                                                [0] => en
                                                            )
    
                                                        [date] => Array
                                                            (
                                                                [0] => Wed, 21 Mar 2018 23:55:56 GMT
                                                            )
    
                                                        [set-cookie] => Array
                                                            (
                                                                [0] => rur=PRN; Path=/
                                                            )
    
                                                        [content-length] => Array
                                                            (
                                                                [0] => 0
                                                            )
    
                                                    )
    
                                            )
    
                                        [status_code] => 301
                                        [protocol_version] => 1.1
                                        [success] => 
                                        [redirects] => 0
                                        [url] => https://instagram.com/tarasangermua
                                        [history] => Array
                                            (
                                            )
    
                                        [cookies] => Requests_Cookie_Jar Object
                                            (
                                                [cookies:protected] => Array
                                                    (
                                                        [rur] => Requests_Cookie Object
                                                            (
                                                                [name] => rur
                                                                [value] => PRN
                                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                                    (
                                                                        [data:protected] => Array
                                                                            (
                                                                                [path] => /
                                                                                [domain] => instagram.com
                                                                            )
    
                                                                    )
    
                                                                [flags] => Array
                                                                    (
                                                                        [creation] => 1521676557
                                                                        [last-access] => 1521676557
                                                                        [persistent] => 
                                                                        [host-only] => 1
                                                                    )
    
                                                                [reference_time] => 1521676557
                                                            )
    
                                                        [csrftoken] => Requests_Cookie Object
                                                            (
                                                                [name] => csrftoken
                                                                [value] => rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6
                                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                                    (
                                                                        [data:protected] => Array
                                                                            (
                                                                                [expires] => 1553126157
                                                                                [max-age] => 1553126157
                                                                                [path] => /
                                                                                [secure] => 1
                                                                                [domain] => instagram.com
                                                                            )
    
                                                                    )
    
                                                                [flags] => Array
                                                                    (
                                                                        [creation] => 1521676557
                                                                        [last-access] => 1521676557
                                                                        [persistent] => 
                                                                        [host-only] => 1
                                                                    )
    
                                                                [reference_time] => 1521676557
                                                            )
    
                                                        [mid] => Requests_Cookie Object
                                                            (
                                                                [name] => mid
                                                                [value] => WrLxDAAEAAFMegV-pjax-HlqsUhc
                                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                                    (
                                                                        [data:protected] => Array
                                                                            (
                                                                                [expires] => 2152396557
                                                                                [max-age] => 2152396557
                                                                                [path] => /
                                                                                [domain] => instagram.com
                                                                            )
    
                                                                    )
    
                                                                [flags] => Array
                                                                    (
                                                                        [creation] => 1521676557
                                                                        [last-access] => 1521676557
                                                                        [persistent] => 
                                                                        [host-only] => 1
                                                                    )
    
                                                                [reference_time] => 1521676557
                                                            )
    
                                                    )
    
                                            )
    
                                    )
    
                            )
    
                        [cookies] => Requests_Cookie_Jar Object
                            (
                                [cookies:protected] => Array
                                    (
                                        [rur] => Requests_Cookie Object
                                            (
                                                [name] => rur
                                                [value] => PRN
                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                    (
                                                        [data:protected] => Array
                                                            (
                                                                [path] => /
                                                                [domain] => instagram.com
                                                            )
    
                                                    )
    
                                                [flags] => Array
                                                    (
                                                        [creation] => 1521676557
                                                        [last-access] => 1521676557
                                                        [persistent] => 
                                                        [host-only] => 1
                                                    )
    
                                                [reference_time] => 1521676557
                                            )
    
                                        [csrftoken] => Requests_Cookie Object
                                            (
                                                [name] => csrftoken
                                                [value] => rBgHQnY0L2gWEUiCS2XBMEub0V8b7jz6
                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                    (
                                                        [data:protected] => Array
                                                            (
                                                                [expires] => 1553126157
                                                                [max-age] => 1553126157
                                                                [path] => /
                                                                [secure] => 1
                                                                [domain] => instagram.com
                                                            )
    
                                                    )
    
                                                [flags] => Array
                                                    (
                                                        [creation] => 1521676557
                                                        [last-access] => 1521676557
                                                        [persistent] => 
                                                        [host-only] => 1
                                                    )
    
                                                [reference_time] => 1521676557
                                            )
    
                                        [mid] => Requests_Cookie Object
                                            (
                                                [name] => mid
                                                [value] => WrLxDAAEAAFMegV-pjax-HlqsUhc
                                                [attributes] => Requests_Utility_CaseInsensitiveDictionary Object
                                                    (
                                                        [data:protected] => Array
                                                            (
                                                                [expires] => 2152396557
                                                                [max-age] => 2152396557
                                                                [path] => /
                                                                [domain] => instagram.com
                                                            )
    
                                                    )
    
                                                [flags] => Array
                                                    (
                                                        [creation] => 1521676557
                                                        [last-access] => 1521676557
                                                        [persistent] => 
                                                        [host-only] => 1
                                                    )
    
                                                [reference_time] => 1521676557
                                            )
    
                                    )
    
                            )
    
                    )
    
                [filename:protected] => 
                [data] => 
                [headers] => 
                [status] => 
            )
    
    )
    
    

    Fun right?

    BUT - here's the thing... once I'd done that and then removed the print_r again, it all worked. Almost as if it somehow flushed it through. Which of course is rubbish. So I tried the same again on each of the other sites that had the problem. Added the print_r, got a page full of Instagram "please wait a few minutes and try again" errors, removed the print_r again and everything is back working. Did this on 4 sites in all, and it fixed all of them.

    Make any sense to you?

    Cheers, Ian

    Plugin Author Scott

    (@scottsweb)

    Interesting. It doesn’t really make sense to me. It looks like a combination of 404 and 301 responses – so, not found and moved. Neither of which appear to be true.

    Are all the sites running on a single IP address and running on the same multisite installation? I am wondering if they are all hitting Instagram in quick succession…although they shouldn’t be in that quick succession because updates are triggered by a page view. But if the sites are busy it is possible.

    Hello,

    having the same issues. You said that this should be the only threat for the error message debug. Any recommendation for WP users that do not have experience with code and only need a quick solution? I use your widget as a recommendation of the Hemlock theme by Solopine and I am in desperate need of a quick fix. My blog looks awful without the Instagram footer.
    Please let me know, how to fix this issue.

    Blog: http://www.waldfriedenstate.com
    Error: 200 code
    Theme: Hemlock by Solopine

    Thanks!
    EVa

    Hello!

    Scott for debug you can change hashtag and data returns.
    But, when you back to your original hashtag it’s returns 404.

    Hope it helps you.

    Thanks,
    Yuriy.

    Hi

    Experienced the same error “Instagram did not return a 200.” upgraded to the latest version and still getting the same error.

    URL: swnymor.net

    Edited: remember to clear cache when using W3Total Cache, then refresh page and hey presto, it works

    Best wishes
    Peter

    • This reply was modified 2 years, 6 months ago by anagio.

    @scott, how about to make requests as logged user ?

    You can test, for example(https://www.instagram.com/explore/tags/siberiablog/?__a=1) as Logged/unLogged user.

    Thanks

    Actually, this error has returned.

    Have disabled W3 Total cache but the error remains

    http://swnymor.net

    Any idea of how to resolve this error?

    For me it Strange, sometimes on the website IT WORK, and then hours later, we get the error message….
    ITS a cookie problem

    Hey folks,
    I’m getting “Instagram: The access_token provided is invalid.” Even though I haven’t changed anything. Updated and cleared everything, still no change… Help? URL: thisslowmind.com Really does look crappy without the instagram feed…

    Plugin Author Scott

    (@scottsweb)

    It just stopped working for me too.. so at least it seems consistent now. When I am next on stable Internet I will investigate.

    Also got the 200 error. Hope a fix will come soon 🙂

    • This reply was modified 2 years, 6 months ago by Sinkadus.
    Plugin Author Scott

    (@scottsweb)

    I haven’t been able to reproduce it again since I saw the issue – the most likely explanation I have right now is that Instagram are blocking a number of requests but I cannot say for sure.

    My plan is to make the plugin handle errors better and keep around an old copy of the images until new ones are successfully retrieved. I won’t able to do this for at least a week though.

    The problem seems to be *mostly* resolved for me also, although still crops up now and again. I suspect your theory is right Scott… possibly some throttling going on behind the scenes with their API (which may or may not be temporary). I’ll keep an eye though.

    Your suggestion for the error handling would be good – some sort of cache of the most recent [however many is set in the plugin] x images, so rather than display a verbose error and bust templates, it just falls back to that instead.

    Cheers for your ongoing work on this.

    Plugin Author Scott

    (@scottsweb)

    Thanks for the update iangeek – I am seeing mostly stable results as well now. I am going to close this thread and track the issue here:

    https://github.com/scottsweb/wp-instagram-widget/issues/90

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Inconsistent 200 error with latest version’ is closed to new replies.