Jamming - then of undefined and tracks is undefined

Been looking at the walkthrough and the solution code, however, I still can’t get the search to work! I do have onClick={this.state} in SearchBar.js button jsx

the error shows in App.js line 34 then of undefined (following code are lines 33-36)

search(searchTerm) {
    Spotify.search(searchTerm).then(searchResults => {
      this.setState({searchResults: searchResults});

and in Spotify.js line 76, tracks is undefined (below are lines 73-78)

).then(jsonResponse => {
                //if the jsonReponse has no tracks property, return an empty array else return an array of objs
                ////says tracks of undefined??
                if(!jsonResponse.tracks) {
                    return [];

and now after deploying to surge, I get
INVALID_CLIENT: Invalid redirect URI
when I have updated the redirectURI to be "http://jamming_playlist_maker.surge.sh/" in Spotify.js

here is a link to the surge site and my github repository without the clientId included:

1 Like

Try removing the trailing slash in the URI definition; this has caused me a similar issue in the past.

1 Like

thanks, I realised my surge site hadn’t updated when I tried that before so redeployed it completely without the ‘/’ and that part now works :slight_smile:

UPDATE: app now works fine as localhost render :slight_smile:
BUT when deployed to surge, the track details do not render to the search results or playlist… D:

Finally figured out what went wrong… the build had not updated to deploy with my new code. I fixed this by deleting it and running npm run build again to remake it. If anyone knows if there’s a way to have it update without deleting and running again that would be helpful!

PS anyone using surge, I have been advised that netlify is better than surge