scottsweb / wp-instagram-widget

❌ A WordPress widget for showing your latest Instagram photos.
115 stars 62 forks source link

Instagram did not return a 200 #103

Closed lddd closed 5 years ago

lddd commented 5 years ago

Hello,

Plugin Version 2.0.3. gives me this error. There might has been changes to the instagram API.

Instagram did not return a 200

best regards!

scottsweb commented 5 years ago

The widget still seems OK for me. Would you be able to help me debug this?

lddd commented 5 years ago

How can i help?

lddd commented 5 years ago

Array ( [code] => 429 [message] => Too Many Requests ...

This is what i get on print_r ($remote);

SubOrbit commented 5 years ago

I have the exact same problem as @lddd

fredoliveira commented 5 years ago

@scottsweb same issue here, fwiw. How can we best help you debug?

scottsweb commented 5 years ago

In order to debug please:

Modify this line:

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 as to what the actual error is.

@lddd Too many requests seems fairly self explanatory. It sounds like Instagram are rate limiting (most likely by IP). A couple of possible ideas:

  1. Check if your are using the filter null_instagram_cache_time in your sites code and reducing the cache time to something to low. A good couple of hours cache is sensible.

  2. It is possible that on certain hosts you will be sharing the same external IP. This would mean every site with the plugin would count against your quota. I am not really sure what I could do to help with this.

scottsweb commented 5 years ago

Closing due to no feedback

phy9pas commented 5 years ago

Was a solution ever found for this? I'm getting this error and wondering what the solution could be. Could I use a proxy to get round this?

scottsweb commented 5 years ago

@phy9pas please follow the debug steps above and report back your findings

phy9pas commented 5 years ago

Hi, I'm not using the null_instagram_cahce_time filter. Here's the output of the $remote dump (attached) debug.txt

DeoThemes commented 5 years ago

I'm having the exact same issue. What is the possible solution here? I've added null_instagram_cache_time filter and set it to 1 hour, but it's not solving the problem.

phy9pas commented 5 years ago

The only solution I could find was to use a proxy to make these external requests. You can do this by adding the proxy settings to your wp-config file.

define( 'WP_PROXY_HOST', 'xxxx.xxx.com' ); define( 'WP_PROXY_PORT', '10000' ); define( 'WP_PROXY_USERNAME', 'xxxxxxx'); define( 'WP_PROXY_PASSWORD', 'xxxxxxxx');

scottsweb commented 5 years ago

From looking at your logs @phy9pas, Instagram is rate limiting your requests.

The page responds with Please wait a few minutes before you try again.

A proxy would ensure you are using a different IP and therefore it is less subject to rate limiting... which is why that is working.

A couple of things that might cause you to be rate limited:

  1. Your cache time is too low, flooding Instagram with requests
  2. You are using a shared hosting environment - in this instance you may share your IP with other sites

Where are you hosting these sites?

phy9pas commented 5 years ago

I've not set any custom cache time, so it will be using the default (which I think is 1 hour?) This is on a low-cost host so my guess is it's shared between lots of sites which may be making similar requests.

scottsweb commented 5 years ago

Default is 2 hours which seems like the best compromise.

Unfortunately there is not a great deal I can do about the hosting situation (other than running a paid for proxy service).