kasperlegarth/instastory.js

Another error

elemis opened this issue · 7 comments

On a certain internet connection, I see an error for line 143, saying:

Uncaught TypeError: Cannot read property 'user' of undefined
    at Object.success (instastory.js:143)
    at u (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at k (jquery.min.js:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2)

Line 143:
$container.html(generateHtml(data.graphql[settings.type]));

Please check http://themes.iki-bir.com/instastory/ for demonstration.

Is there a way to fix this issue?

Hi again, i have made a little change to fix your other issue. I suspect that this might have to do with the other issue. Can you try to fix that one first, and then get back to me if this issue is still present?

Otherwise, let me know if there is anything i can help you with 👍

Caption issue is fixed. Thank you. Bu we keep getting this error on a certain internet connection after a few refreshes.

Hi @elemis do you have more info that "certain internet connection"? I don't see the error on your test site. So it is a little hard for me to debug?

Sorry for not being clear. Wasn't sure about how and why it happened so couldn't explain properly. But now guess I have an idea. We put the script on a website and the feed is available on several pages of the website, while checking with my partner on different devices and connections, after a while he started getting the error with blank feed. Could there be a limitation on Instagram side somehow so after a while it blocks the IP somehow?

Some of the pages from the website with the feed are as follows:
http://themes.iki-bir.com/missio/index.html
http://themes.iki-bir.com/missio/index7.html
http://themes.iki-bir.com/missio/index9.html
http://themes.iki-bir.com/missio/index16.html
http://themes.iki-bir.com/missio/index22.html
http://themes.iki-bir.com/missio/index23.html

I have tried to debug a little on it. And i think that you right. Instagram indeed seems to have some kind of limitation on the URL. When it stops working it is due to the fact that the URL redirects to the login page.

Was is wired though, is that it only seems to be on the user feeds. I still have access to hashtag feeds, even after i got my IP blocked.

What i think made it worse in your case is that the plugin always makes the request, even though the desired DOM element is not present on the current page. So on your template the page would make 8 requests each time a page was loaded.

So to prevent unnecessary requests i have made a new release where the plugin starts by checking if the desired DOM element is present. I'm afraid that is the best i can do.

Do your blocked IP starts working again later or is it for good?

This last update seems to solve the issue. Thank you very much for your time and help!

That sounds great!
No problem, let me know if i can help with anything else :)