Codecademy Forums

Help with jammming project

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Hello, I am REALLY STRUGGLING with this jammming app. I have 2 issues:
1. I keep getting an error that states:

TypeError: Cannot read property ‘then’ of undefined

47 |
48 | savePlaylist() {
49 | const trackUris = => track.uri);>
50 | Spotify.savePlaylist(this.state.playlistName, trackUris).then(() => { | ^
51 | this.setState({
52 | playlistName: ‘New Playlist’,
53 | playlistTracks:

2. My app will not list any results.

Below is my Spotify.js code:


spotify.txt (2.6 KB)

Below is my App.js code:

app.txt (2.6 KB)

Any help would be greatly appreciated!

Same issue. My app was working up until we connected to Spotify, so it must be something with the ‘then’ chaining. My eyes are strained now, so will have to pick it back up later. I’ve watched, re-watched and watched some more and I can’t figure out where my issue is.

So, I was sitting here thinking, we never added functionality to actually fire the search when the button was clicked… Maybe I missed it when going back through the video? Either way, this resolved my issue.

In your SearchBar.js file, locate the button and try adding: onClick={}

I’d love to know if this worked for you!


OMG!!! That worked!!!

I watched that video 5 or 6 times. Did I miss this too!?! Thank you sooooooooooooooooooooooooooooooooooooooo jdrmiller!!!

1 Like

Thanks for that, I was having the same issue. Problem now is that once I click the search bar, I get an invalid client error page. Any clue why this is happening?

Please help!

Make sure your redirect url matches exactly to the url in the spotify dashboard. Mine was missing the trailing slash, once resolved, no Invalid client errors. Good luck!

1 Like

Thanks for pointing that out, it wasn’t the issue but it set my eyes to the right direction. Instead of passing down clientId to the conditional statement, I wrote ${clientID}. I used capital letter on the d. Well that solved that issue which brought me to a new one.

Right, now everything seems to be working well, I type in the artist name, click search and the function actually works. I then add a few songs to the playlist and change the name.

Problem is, when I press the button save to Spotify. This happens:

I re-watched the video a few times and I don’t see what can possible be wrong.

Any suggestions?

Hi there, regarding your first issue,

1. I keep getting an error that states:

TypeError: Cannot read property ‘then’ of undefined

What did you do to fix that?

@rdefa001 I only received that error when I was trying to save an empty playlist. Once I resolved the search issue, I no longer received errors. Can you post your code and I’ll take a look? Maybe start a new thread?

1 Like

I kept getting that “then undefined” error until I added the onClick={ to the button in searchbar.js. After that, it went away.

1 Like