Twitch project, API returning brunofin and comster404 as undefined?

Hi guys, I’ve finally gotten somewhere with this project. One issue I’m having is that brunofin and comster404 don’t seem to be processed through the API call. It just returns undefined. I tried experimenting and tried to get it to do a console.log with the error part of the ajax but nothing, just acts like everything is a success and brunofin and comster404 come up as undefined.

Sorry if this is badly explained, still very new to coding so I don’t know the proper terms. Heres the link to my codepen.

Thank you in advance.

Well it’s not really “failing” in that your code is failing, BUT for example look here:

and at brunofin. They both come up undefined. Im not really sure of the reason for this mine actually does this as well. Maybe their channel’s have some private settings or something? But you can check the same link above for another user and it will return fine. So I don’t necessarily think this is a “code issue”

Hmm, I’ve had a look at other peoples codepens and there’s was able to still spit out the usernames while mine just says undefined. Maybe its something to do with the fact that we use a different API pass through now? “” versus “”?

I imagine maybe that could have something to do with it. Im using the wind-bow as well and have the same issue.

Im pretty sure less people use kraken because of this (see fcc project page for twitch app):

UPDATE: Due to a change in conditions on API usage explained here now requires an API key, but we’ve built a workaround. Use instead of twitch’s API base URL (i.e. ) and you’ll still be able to get account information, without needing to sign up for an API key.

They’re undefined because they’re deactivated Twitch accounts.

The first AJAX function works, but because Twitch returns undefined for inactive accounts, is undefined. So when you go to make your URL using, it gets set with undefined, which is then the user that Twitch looks for. Since there isn’t anything wrong with the network calls, the error handler won’t kick it. You have to manage what happens when Twitch returns undefined.

Oh, okay thank you! Any tips on how to go about managing that?

I assumed they were purposely added to make sure that our code can handle closed accounts:

User Story: I will see a placeholder notification if a streamer has closed their Twitch account (or the account never existed). You can verify this works by adding brunofin and comster404 to your array of Twitch streamers.

Just think about how you want to convey this information to the user. undefined could mean that the user deleted their account, but it could also mean that there was never an account in the first place. You’ve already got some code for users that aren’t found, it’s just a matter of changing your logic a bit to make use of it.